Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,16 +27,16 @@ def respond(message, history):
|
|
| 27 |
|
| 28 |
messages.append({"role": "user", "content": message})
|
| 29 |
|
| 30 |
-
#
|
| 31 |
-
response = client.chat_completion(messages, max_tokens=200, temperature=0.7)
|
| 32 |
|
| 33 |
-
# Extract
|
| 34 |
bot_reply = response.choices[0].message.content.strip()
|
| 35 |
|
| 36 |
# β
Append correctly formatted tuple to history
|
| 37 |
history.append((message, bot_reply))
|
| 38 |
|
| 39 |
-
# β
Return chatbot history and state
|
| 40 |
return history, history
|
| 41 |
|
| 42 |
# Create Gradio chatbot UI
|
|
|
|
| 27 |
|
| 28 |
messages.append({"role": "user", "content": message})
|
| 29 |
|
| 30 |
+
# β
Ensure streaming is disabled to prevent looping
|
| 31 |
+
response = client.chat_completion(messages, max_tokens=200, temperature=0.7, stream=False)
|
| 32 |
|
| 33 |
+
# β
Extract response only once
|
| 34 |
bot_reply = response.choices[0].message.content.strip()
|
| 35 |
|
| 36 |
# β
Append correctly formatted tuple to history
|
| 37 |
history.append((message, bot_reply))
|
| 38 |
|
| 39 |
+
# β
Return chatbot history and state
|
| 40 |
return history, history
|
| 41 |
|
| 42 |
# Create Gradio chatbot UI
|