Gradio fix
Browse files
app.py
CHANGED
|
@@ -119,7 +119,9 @@ with gr.Blocks() as demo:
|
|
| 119 |
|
| 120 |
def respond(message, chat_history):
|
| 121 |
reply = chat_fn(message, chat_history)
|
| 122 |
-
|
|
|
|
|
|
|
| 123 |
return "", chat_history
|
| 124 |
|
| 125 |
send_btn.click(respond, [msg, chatbot], [msg, chatbot])
|
|
|
|
| 119 |
|
| 120 |
def respond(message, chat_history):
|
| 121 |
reply = chat_fn(message, chat_history)
|
| 122 |
+
# Gradio expects messages format with role/content
|
| 123 |
+
chat_history.append({"role": "user", "content": message})
|
| 124 |
+
chat_history.append({"role": "assistant", "content": reply})
|
| 125 |
return "", chat_history
|
| 126 |
|
| 127 |
send_btn.click(respond, [msg, chatbot], [msg, chatbot])
|