Spaces:
Sleeping
Critical fix: Resolve Gradio component type and parameter compatibility issues
Browse files🐛 Critical Bug Fixes:
1. Chatbot type mismatch: Change 'type="messages"' to 'type="tuples"'
- Code uses tuple format [user_msg, bot_msg] throughout
- "messages" type expects OpenAI format {role: "", content: ""}
- This mismatch would cause chat functionality to fail
2. File component height parameter: Remove 'height=120'
- Height parameter not supported in newer Gradio versions
- Keep essential parameters: file_count, file_types, label
🔧 Root Cause Analysis:
- Chatbot event handlers expect tuple format
- bot_response() function manipulates history as list of [user, bot] tuples
- user_input() appends [message, None] tuples to history
- All chat logic built around tuple structure
✅ Compatibility Status:
- All deprecated parameters removed
- Component types matched to actual usage patterns
- Event handlers aligned with component expectations
- Ready for Gradio 5.0+ and HuggingFace Spaces
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
@@ -472,7 +472,7 @@ class HuggingFaceApp:
|
|
| 472 |
height=500,
|
| 473 |
placeholder="안녕하세요! 소방 복무관리에 대해 무엇이 궁금하신가요?",
|
| 474 |
avatar_images=["👤", "🤖"],
|
| 475 |
-
type="
|
| 476 |
)
|
| 477 |
|
| 478 |
# 입력 영역
|
|
@@ -560,8 +560,7 @@ class HuggingFaceApp:
|
|
| 560 |
uploaded_files = gr.File(
|
| 561 |
file_count="multiple",
|
| 562 |
file_types=[".txt", ".pdf", ".docx", ".xlsx", ".csv"],
|
| 563 |
-
label="복무관리 문서 파일"
|
| 564 |
-
height=120
|
| 565 |
)
|
| 566 |
|
| 567 |
with gr.Row():
|
|
|
|
| 472 |
height=500,
|
| 473 |
placeholder="안녕하세요! 소방 복무관리에 대해 무엇이 궁금하신가요?",
|
| 474 |
avatar_images=["👤", "🤖"],
|
| 475 |
+
type="tuples"
|
| 476 |
)
|
| 477 |
|
| 478 |
# 입력 영역
|
|
|
|
| 560 |
uploaded_files = gr.File(
|
| 561 |
file_count="multiple",
|
| 562 |
file_types=[".txt", ".pdf", ".docx", ".xlsx", ".csv"],
|
| 563 |
+
label="복무관리 문서 파일"
|
|
|
|
| 564 |
)
|
| 565 |
|
| 566 |
with gr.Row():
|