artificialguybr commited on
Commit
64f86b5
1 Parent(s): e61245d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -26,9 +26,9 @@ def regenerate(chatbot, chat_history_state, system_msg, max_tokens, temperature,
26
  if not chat_history_state:
27
  return chatbot, chat_history_state, ""
28
 
29
- # Remove the last item from the chat history
30
  if len(chat_history_state) > 0:
31
- chat_history_state.pop(-1)
32
 
33
  # Re-run the chat function
34
  new_history, _, _ = chat(chat_history_state, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty)
@@ -36,6 +36,7 @@ def regenerate(chatbot, chat_history_state, system_msg, max_tokens, temperature,
36
  return new_history, new_history, ""
37
 
38
 
 
39
  def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty):
40
  history = history or []
41
 
 
26
  if not chat_history_state:
27
  return chatbot, chat_history_state, ""
28
 
29
+ # Remove only the last assistant's message from the chat history
30
  if len(chat_history_state) > 0:
31
+ chat_history_state[-1][1] = ""
32
 
33
  # Re-run the chat function
34
  new_history, _, _ = chat(chat_history_state, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty)
 
36
  return new_history, new_history, ""
37
 
38
 
39
+
40
  def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty):
41
  history = history or []
42