Update app.py
Browse files
app.py
CHANGED
|
@@ -60,10 +60,16 @@ with gr.Blocks(title="kFlash 1.3") as demo:
|
|
| 60 |
return "", history + [[user_message, None]]
|
| 61 |
|
| 62 |
def bot_reply(history):
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
for partial in respond(history[-1][0], history[:-1]):
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
| 67 |
|
| 68 |
msg.submit(user_submit, [msg, chatbot], [msg, chatbot]).then(
|
| 69 |
bot_reply, chatbot, chatbot
|
|
|
|
| 60 |
return "", history + [[user_message, None]]
|
| 61 |
|
| 62 |
def bot_reply(history):
|
| 63 |
+
if not history:
|
| 64 |
+
return history
|
| 65 |
+
|
| 66 |
+
# Kerää vastaus kokonaan ennen kuin päivität UI:ta
|
| 67 |
+
full_response = ""
|
| 68 |
for partial in respond(history[-1][0], history[:-1]):
|
| 69 |
+
full_response = partial
|
| 70 |
+
|
| 71 |
+
history[-1][1] = full_response
|
| 72 |
+
return history
|
| 73 |
|
| 74 |
msg.submit(user_submit, [msg, chatbot], [msg, chatbot]).then(
|
| 75 |
bot_reply, chatbot, chatbot
|