Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,15 +10,18 @@ def respond(message, history):
|
|
| 10 |
messages.extend(history)
|
| 11 |
messages.append({"role": "user", "content": message})
|
| 12 |
|
| 13 |
-
response = client.chat_completion(
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
return response.choices[0].message.content.strip()
|
| 21 |
-
|
| 22 |
chatbot = gr.ChatInterface(respond, title="my bot")
|
| 23 |
|
| 24 |
|
|
|
|
| 10 |
messages.extend(history)
|
| 11 |
messages.append({"role": "user", "content": message})
|
| 12 |
|
| 13 |
+
# response = client.chat_completion(
|
| 14 |
+
# messages,
|
| 15 |
+
# max_tokens=100,
|
| 16 |
+
# temperature = 1.5,
|
| 17 |
+
# top_p = 0.34
|
| 18 |
+
# )
|
| 19 |
+
response = client.chat_completion(stream=True)
|
| 20 |
+
for msg in response:
|
| 21 |
+
token = message.choices[0].delta.content
|
| 22 |
+
response += token
|
| 23 |
+
yield token #response.choices[0].message.content.strip()
|
| 24 |
|
|
|
|
|
|
|
| 25 |
chatbot = gr.ChatInterface(respond, title="my bot")
|
| 26 |
|
| 27 |
|