bstraehle commited on
Commit
50ddfc1
·
verified ·
1 Parent(s): e04bd50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -121,14 +121,15 @@ def extract_content_values(data):
121
  return content_values
122
 
123
  def chat(message, history):
 
 
 
124
  global client, assistant, thread
125
-
126
- print(history)
127
 
128
  if assistant == None:
129
  assistant = load_assistant(client)
130
 
131
- if thread == None:
132
  thread = create_thread(client)
133
 
134
  create_message(client, thread, message)
 
121
  return content_values
122
 
123
  def chat(message, history):
124
+ if not message:
125
+ raise gr.Error("Message is required.")
126
+
127
  global client, assistant, thread
 
 
128
 
129
  if assistant == None:
130
  assistant = load_assistant(client)
131
 
132
+ if len(history) == 0:
133
  thread = create_thread(client)
134
 
135
  create_message(client, thread, message)