Commit
·
e8fe06f
1
Parent(s):
163e70a
Fixing the streaming of responses
Browse files- src/manager/manager.py +5 -5
src/manager/manager.py
CHANGED
@@ -282,13 +282,13 @@ class GeminiManager:
|
|
282 |
for chunk in response_stream:
|
283 |
if chunk.text:
|
284 |
full_text += chunk.text
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
|
|
289 |
for candidate in chunk.candidates:
|
290 |
if candidate.content and candidate.content.parts:
|
291 |
-
# messages.append(response.candidates[0].content)
|
292 |
function_call_requests.append({
|
293 |
"role": "function_call",
|
294 |
"content": repr(candidate.content),
|
|
|
282 |
for chunk in response_stream:
|
283 |
if chunk.text:
|
284 |
full_text += chunk.text
|
285 |
+
if chunk.text.strip() != "":
|
286 |
+
yield messages + [{
|
287 |
+
"role": "assistant",
|
288 |
+
"content": full_text
|
289 |
+
}]
|
290 |
for candidate in chunk.candidates:
|
291 |
if candidate.content and candidate.content.parts:
|
|
|
292 |
function_call_requests.append({
|
293 |
"role": "function_call",
|
294 |
"content": repr(candidate.content),
|