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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -23,15 +23,21 @@ def user(message, history):
23
  return "", history
24
 
25
  def regenerate(chatbot, chat_history_state, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty):
 
 
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)
 
35
 
36
  return new_history, new_history, ""
37
 
 
23
  return "", history
24
 
25
  def regenerate(chatbot, chat_history_state, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty):
26
+ print("Regenerate function called") # Debug print
27
+
28
  if not chat_history_state:
29
+ print("Chat history is empty") # Debug print
30
  return chatbot, chat_history_state, ""
31
 
32
  # Remove only the last assistant's message from the chat history
33
  if len(chat_history_state) > 0:
34
+ print(f"Before: {chat_history_state[-1]}") # Debug print
35
  chat_history_state[-1][1] = ""
36
+ print(f"After: {chat_history_state[-1]}") # Debug print
37
 
38
  # Re-run the chat function
39
  new_history, _, _ = chat(chat_history_state, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty)
40
+ print(f"New history: {new_history}") # Debug print
41
 
42
  return new_history, new_history, ""
43