arubaDev commited on
Commit
6e5a889
·
verified ·
1 Parent(s): 95a8be8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -188,9 +188,9 @@ def send_cb(user_text, selected_label, chatbot_msgs, system_message, max_tokens,
188
  update_session_title_if_needed(sid, user_text)
189
 
190
  api_messages = build_api_messages(sid, system_message)
191
- display_msgs = get_messages(sid)
192
 
193
- # Add initial empty assistant message for typing indicator
194
  display_msgs.append({"role": "assistant", "content": "…"})
195
  yield (display_msgs, "", selected_label)
196
 
@@ -211,11 +211,11 @@ def send_cb(user_text, selected_label, chatbot_msgs, system_message, max_tokens,
211
  yield (display_msgs, "", selected_label)
212
  add_message(sid, "assistant", partial)
213
  except Exception as e:
214
- err = f"⚠️ Error: {str(e)}"
215
- display_msgs[-1]["content"] = err
216
  yield (display_msgs, "", selected_label)
217
 
218
 
 
219
  def regenerate_cb(selected_label, system_message, max_tokens, temperature, top_p, model_choice, dataset_choice):
220
  sid = label_to_id(selected_label)
221
  if sid is None:
 
188
  update_session_title_if_needed(sid, user_text)
189
 
190
  api_messages = build_api_messages(sid, system_message)
191
+ display_msgs = chatbot_msgs[:] # Use existing chat content
192
 
193
+ # Add initial assistant message for typing
194
  display_msgs.append({"role": "assistant", "content": "…"})
195
  yield (display_msgs, "", selected_label)
196
 
 
211
  yield (display_msgs, "", selected_label)
212
  add_message(sid, "assistant", partial)
213
  except Exception as e:
214
+ display_msgs[-1]["content"] = f"⚠️ Error: {str(e)}"
 
215
  yield (display_msgs, "", selected_label)
216
 
217
 
218
+
219
  def regenerate_cb(selected_label, system_message, max_tokens, temperature, top_p, model_choice, dataset_choice):
220
  sid = label_to_id(selected_label)
221
  if sid is None: