Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,15 +47,10 @@ def respond(
|
|
47 |
stream=True,
|
48 |
)
|
49 |
partial_message = ""
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
chat_history = chat_history + [(message, partial_message)]
|
55 |
-
yield chat_history
|
56 |
-
except Exception as e:
|
57 |
-
error_message = f"An error occurred: {str(e)}"
|
58 |
-
chat_history.append((message, error_message))
|
59 |
yield chat_history
|
60 |
|
61 |
def clear_conversation():
|
|
|
47 |
stream=True,
|
48 |
)
|
49 |
partial_message = ""
|
50 |
+
for response in stream:
|
51 |
+
if response.choices[0].delta.content is not None:
|
52 |
+
partial_message += response.choices[0].delta.content
|
53 |
+
chat_history = chat_history[:-1] + [(message, partial_message)]
|
|
|
|
|
|
|
|
|
|
|
54 |
yield chat_history
|
55 |
|
56 |
def clear_conversation():
|