Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,7 +19,7 @@ def get_thread_id(streaming_chat_thread_id_state):
|
|
| 19 |
# except TypeError as e:
|
| 20 |
# thread_id = None
|
| 21 |
thread_id = streaming_chat_thread_id
|
| 22 |
-
if not thread_id:
|
| 23 |
thread = client.beta.threads.create()
|
| 24 |
thread_id = thread.id
|
| 25 |
print(f"new thread_id: {thread_id}")
|
|
@@ -51,6 +51,6 @@ def chat(user_message, history, streaming_chat_thread_id):
|
|
| 51 |
yield from openai_chat(user_message, thread_id)
|
| 52 |
|
| 53 |
history = []
|
| 54 |
-
streaming_chat_thread_id =
|
| 55 |
additional_inputs = [streaming_chat_thread_id]
|
| 56 |
gr.ChatInterface(chat, examples=[["What are the troy rack mounting options?"], ["what are the steps for helen"], ["what are the main comparison between troy and janus specs"]], title="User Support Bot", additional_inputs=additional_inputs).launch(debug=True)
|
|
|
|
| 19 |
# except TypeError as e:
|
| 20 |
# thread_id = None
|
| 21 |
thread_id = streaming_chat_thread_id
|
| 22 |
+
if not thread_id or thread_id == "Demo":
|
| 23 |
thread = client.beta.threads.create()
|
| 24 |
thread_id = thread.id
|
| 25 |
print(f"new thread_id: {thread_id}")
|
|
|
|
| 51 |
yield from openai_chat(user_message, thread_id)
|
| 52 |
|
| 53 |
history = []
|
| 54 |
+
streaming_chat_thread_id = "Demo"# = gr.State({"thread_id": None})
|
| 55 |
additional_inputs = [streaming_chat_thread_id]
|
| 56 |
gr.ChatInterface(chat, examples=[["What are the troy rack mounting options?"], ["what are the steps for helen"], ["what are the main comparison between troy and janus specs"]], title="User Support Bot", additional_inputs=additional_inputs).launch(debug=True)
|