misukisu commited on
Commit
898ef48
·
verified ·
1 Parent(s): 16f3b71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
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
- history[-1][1] = ""
 
 
 
 
64
  for partial in respond(history[-1][0], history[:-1]):
65
- history[-1][1] = partial
66
- yield history
 
 
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