Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -106,15 +106,16 @@ def respond(message, api_key, max_tokens, top_p, temperature):
|
|
106 |
if response.status_code == 200:
|
107 |
assistant_reply = ""
|
108 |
for line in response.iter_lines(decode_unicode=True):
|
|
|
109 |
if line:
|
110 |
try:
|
111 |
chunk = json.loads(line)
|
112 |
chunk_message = chunk.get("chunk", {}).get("content", "")
|
113 |
assistant_reply += chunk_message
|
114 |
-
|
115 |
yield assistant_reply
|
116 |
except Exception as e:
|
117 |
-
|
|
|
118 |
|
119 |
history.append((message, assistant_reply, "You", "P-ALPLE", sessions[api_key]["avatar"], ASSISTANT_PIC_PATH))
|
120 |
sessions[api_key]["history"] = history
|
|
|
106 |
if response.status_code == 200:
|
107 |
assistant_reply = ""
|
108 |
for line in response.iter_lines(decode_unicode=True):
|
109 |
+
print(f"Received line: {line}") # Debugging
|
110 |
if line:
|
111 |
try:
|
112 |
chunk = json.loads(line)
|
113 |
chunk_message = chunk.get("chunk", {}).get("content", "")
|
114 |
assistant_reply += chunk_message
|
|
|
115 |
yield assistant_reply
|
116 |
except Exception as e:
|
117 |
+
print(f"Stream chunk error: {e}")
|
118 |
+
|
119 |
|
120 |
history.append((message, assistant_reply, "You", "P-ALPLE", sessions[api_key]["avatar"], ASSISTANT_PIC_PATH))
|
121 |
sessions[api_key]["history"] = history
|