Spaces:
Runtime error
Runtime error
Enrique Cardoza commited on
Commit ·
ce89e4f
1
Parent(s): c6025f4
feat(ux): clear message input field after submission
Browse files- Add clear_message_input function that returns an empty string
- Connect function to message submission event with queue=False
- Improve user experience by automatically clearing input after sending
- Allow faster sequential message entry without manual clearing
app.py
CHANGED
|
@@ -417,6 +417,11 @@ with gr.Blocks() as demo:
|
|
| 417 |
# Connect components
|
| 418 |
btn.click(chat_with_tools, [msg, chatbot, groq_api_key_input, anthropic_api_key_input], [chatbot], queue=True)
|
| 419 |
msg.submit(chat_with_tools, [msg, chatbot, groq_api_key_input, anthropic_api_key_input], [chatbot], queue=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
# Clear button
|
| 422 |
clear = gr.Button("Clear Conversation")
|
|
|
|
| 417 |
# Connect components
|
| 418 |
btn.click(chat_with_tools, [msg, chatbot, groq_api_key_input, anthropic_api_key_input], [chatbot], queue=True)
|
| 419 |
msg.submit(chat_with_tools, [msg, chatbot, groq_api_key_input, anthropic_api_key_input], [chatbot], queue=True)
|
| 420 |
+
|
| 421 |
+
# Clear message input field after sending
|
| 422 |
+
def clear_message_input():
|
| 423 |
+
return ""
|
| 424 |
+
msg.submit(clear_message_input, [], [msg], queue=False)
|
| 425 |
|
| 426 |
# Clear button
|
| 427 |
clear = gr.Button("Clear Conversation")
|