Tonic commited on
Commit
ba47eaa
β€’
1 Parent(s): 4876138

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -124,11 +124,13 @@ def regenerate(_chatbot, task_history):
124
  return predict(_chatbot, task_history)
125
 
126
  def add_text(history, task_history, text):
127
- print("Add Text - Before: task_history =", task_history)
 
 
128
  history.append((_parse_text(text), None))
129
  task_history.append((text, None))
130
- print("Add Text - End: task_history =", task_history)
131
- return history, task_history, ""
132
 
133
  def add_file(history, task_history, file):
134
  print("Add File - Before: task_history =", task_history)
@@ -152,8 +154,8 @@ def reset_user_input():
152
  return gr.update(value="")
153
 
154
  def reset_state(task_history):
155
- print("Reset State - Before: task_history =", task_history)
156
- task_history.clear()
157
  print("Reset State - After: task_history =", task_history)
158
  return []
159
 
 
124
  return predict(_chatbot, task_history)
125
 
126
  def add_text(history, task_history, text):
127
+ print("Add Text - Before: task_history =", task_history)
128
+ if not isinstance(task_history, list):
129
+ task_history = []
130
  history.append((_parse_text(text), None))
131
  task_history.append((text, None))
132
+ print("Add Text - After: task_history =", task_history)
133
+ return history, task_history, "
134
 
135
  def add_file(history, task_history, file):
136
  print("Add File - Before: task_history =", task_history)
 
154
  return gr.update(value="")
155
 
156
  def reset_state(task_history):
157
+ print("Reset State - Before: task_history =", task_history)
158
+ task_history = [] # Reset task_history to an empty list
159
  print("Reset State - After: task_history =", task_history)
160
  return []
161