Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,13 +22,14 @@ def runpod_chat(question, history=None):
|
|
22 |
stream=True,
|
23 |
)
|
24 |
|
25 |
-
# Stream the response and
|
26 |
-
full_response = ""
|
27 |
for message in response_stream:
|
28 |
-
|
29 |
-
full_response +=
|
30 |
-
|
31 |
-
|
|
|
32 |
|
33 |
return full_response, history # Return full response and updated history to maintain state
|
34 |
|
|
|
22 |
stream=True,
|
23 |
)
|
24 |
|
25 |
+
# Stream the response and accumulate full response before displaying
|
26 |
+
full_response = "RunPod: "
|
27 |
for message in response_stream:
|
28 |
+
part = message.choices[0].delta.content if message.choices[0].delta.content is not None else ""
|
29 |
+
full_response += part
|
30 |
+
|
31 |
+
# Append the full response to history once complete
|
32 |
+
history.append({"role": "assistant", "content": full_response})
|
33 |
|
34 |
return full_response, history # Return full response and updated history to maintain state
|
35 |
|