artificialguybr commited on
Commit
c314120
1 Parent(s): bce3dcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -23,25 +23,21 @@ def user(message, history):
23
  return "", history
24
 
25
  def regenerate(_chatbot, _task_history, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty):
 
26
  if not _task_history:
27
  yield _chatbot
28
  return
29
- # Remove the last bot message from history
30
  last_message = _task_history.pop(-1)
31
  _chatbot.pop(-1)
32
-
33
- # Re-add the user's part of the last message to history
34
  _task_history.append([last_message[0], ""])
35
-
36
- # Regenerate the message using the chat function
37
  new_history, _, _ = chat(_task_history, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty)
38
-
39
- # Update the chatbot state
40
  yield new_history
41
 
42
 
43
 
44
 
 
45
  def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty):
46
  history = history or []
47
 
 
23
  return "", history
24
 
25
  def regenerate(_chatbot, _task_history, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty):
26
+ print("Regenerate called") # Debugging line
27
  if not _task_history:
28
  yield _chatbot
29
  return
 
30
  last_message = _task_history.pop(-1)
31
  _chatbot.pop(-1)
 
 
32
  _task_history.append([last_message[0], ""])
 
 
33
  new_history, _, _ = chat(_task_history, system_msg, max_tokens, temperature, top_p, top_k, repetition_penalty)
34
+ print(f"New history: {new_history}") # Debugging line
 
35
  yield new_history
36
 
37
 
38
 
39
 
40
+
41
  def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty):
42
  history = history or []
43