Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,6 @@ from langfuse.decorators import observe
|
|
| 6 |
|
| 7 |
client = OpenAI()
|
| 8 |
assistant_id=os.environ["OPENAI_ASSISTANT_ID"]
|
| 9 |
-
|
| 10 |
def create_thread_id():
|
| 11 |
thread = client.beta.threads.create()
|
| 12 |
thread_id = thread.id
|
|
@@ -43,10 +42,10 @@ def openai_chat(user_message, state):
|
|
| 43 |
total += delta
|
| 44 |
yield total
|
| 45 |
|
| 46 |
-
def chat(user_message, history,
|
| 47 |
-
yield from openai_chat(user_message,
|
| 48 |
|
| 49 |
history = []
|
| 50 |
-
streaming_chat_thread_id_state = gr.State({ "thread_id": None})
|
| 51 |
additional_inputs = [streaming_chat_thread_id_state]
|
| 52 |
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)
|
|
|
|
| 6 |
|
| 7 |
client = OpenAI()
|
| 8 |
assistant_id=os.environ["OPENAI_ASSISTANT_ID"]
|
|
|
|
| 9 |
def create_thread_id():
|
| 10 |
thread = client.beta.threads.create()
|
| 11 |
thread_id = thread.id
|
|
|
|
| 42 |
total += delta
|
| 43 |
yield total
|
| 44 |
|
| 45 |
+
def chat(user_message, history, streaming_chat_thread_id_state):
|
| 46 |
+
yield from openai_chat(user_message, streaming_chat_thread_id_state)
|
| 47 |
|
| 48 |
history = []
|
| 49 |
+
streaming_chat_thread_id_state = gr.State( { "thread_id": None})
|
| 50 |
additional_inputs = [streaming_chat_thread_id_state]
|
| 51 |
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)
|