Jinze commited on
Commit
79dd573
1 Parent(s): 8d0e615

fix empty input bug

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -185,13 +185,15 @@ def _launch_demo(args):
185
 
186
  def add_text(history, task_history, text):
187
  task_text = text
188
- if len(text) >= 2 and text[-1] in PUNCTUATION and text[-2] not in PUNCTUATION:
189
- task_text = text[:-1]
190
  history = history + [(_parse_text(text), None)]
191
  task_history = task_history + [(task_text, None)]
192
  return history, task_history, ""
193
 
194
  def add_file(history, task_history, file):
 
 
195
  history = history + [((file.name,), None)]
196
  task_history = task_history + [((file.name,), None)]
197
  return history, task_history
 
185
 
186
  def add_text(history, task_history, text):
187
  task_text = text
188
+ history = history if history is not None else []
189
+ task_history = task_history if task_history is not None else []
190
  history = history + [(_parse_text(text), None)]
191
  task_history = task_history + [(task_text, None)]
192
  return history, task_history, ""
193
 
194
  def add_file(history, task_history, file):
195
+ history = history if history is not None else []
196
+ task_history = task_history if task_history is not None else []
197
  history = history + [((file.name,), None)]
198
  task_history = task_history + [((file.name,), None)]
199
  return history, task_history