Chad commited on
Commit ·
be0984b
1
Parent(s): 2888244
uwdwndwfbfbewdwdwdwdwd boxdwdwdwdwdwd
Browse files
app.py
CHANGED
|
@@ -13,7 +13,9 @@ def respond(user_input, chat_history):
|
|
| 13 |
if chat_history is None:
|
| 14 |
chat_history = []
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
conversation = [{"role": "system", "content": (
|
| 19 |
"Determine the language of the user's question and respond in the same language. "
|
|
@@ -49,7 +51,7 @@ def respond(user_input, chat_history):
|
|
| 49 |
|
| 50 |
with gr.Blocks() as demo:
|
| 51 |
with gr.Row():
|
| 52 |
-
chatbot = gr.Chatbot(height=450, type="
|
| 53 |
|
| 54 |
chat = gr.ChatInterface(
|
| 55 |
respond,
|
|
|
|
| 13 |
if chat_history is None:
|
| 14 |
chat_history = []
|
| 15 |
|
| 16 |
+
if isinstance(chat_history, list):
|
| 17 |
+
chat_history = [(str(msg[0]), str(msg[1])) for msg in chat_history if isinstance(msg, (list, tuple)) and len(msg) == 2]
|
| 18 |
+
|
| 19 |
|
| 20 |
conversation = [{"role": "system", "content": (
|
| 21 |
"Determine the language of the user's question and respond in the same language. "
|
|
|
|
| 51 |
|
| 52 |
with gr.Blocks() as demo:
|
| 53 |
with gr.Row():
|
| 54 |
+
chatbot = gr.Chatbot(height=450, type="tuple")
|
| 55 |
|
| 56 |
chat = gr.ChatInterface(
|
| 57 |
respond,
|