Spaces:
Sleeping
Sleeping
rah
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ If the user gets too personal, remind them that YOU ARE NOT A PROFESSIONAL; THEY
|
|
| 16 |
if history:
|
| 17 |
messages.extend(history)
|
| 18 |
messages.append({"role":"user","content":message})
|
| 19 |
-
|
| 20 |
messages,
|
| 21 |
max_tokens=100,
|
| 22 |
temperature= 0.9,
|
|
@@ -24,8 +24,8 @@ If the user gets too personal, remind them that YOU ARE NOT A PROFESSIONAL; THEY
|
|
| 24 |
stream=True
|
| 25 |
)
|
| 26 |
response= ""
|
| 27 |
-
for
|
| 28 |
-
token=
|
| 29 |
if response:
|
| 30 |
response+=token
|
| 31 |
yield response
|
|
|
|
| 16 |
if history:
|
| 17 |
messages.extend(history)
|
| 18 |
messages.append({"role":"user","content":message})
|
| 19 |
+
stream= client.chat_completion(
|
| 20 |
messages,
|
| 21 |
max_tokens=100,
|
| 22 |
temperature= 0.9,
|
|
|
|
| 24 |
stream=True
|
| 25 |
)
|
| 26 |
response= ""
|
| 27 |
+
for msg in stream:
|
| 28 |
+
token=msg.choices[0].delta.content
|
| 29 |
if response:
|
| 30 |
response+=token
|
| 31 |
yield response
|