Commit ·
0660121
1
Parent(s): 1f35fad
fixed the bug with empty functions
Browse files- src/manager/manager.py +7 -4
src/manager/manager.py
CHANGED
|
@@ -297,13 +297,16 @@ class GeminiManager:
|
|
| 297 |
print(chunk)
|
| 298 |
for candidate in chunk.candidates:
|
| 299 |
if candidate.content and candidate.content.parts:
|
| 300 |
-
|
| 301 |
-
"role": "function_call",
|
| 302 |
-
"content": repr(candidate.content),
|
| 303 |
-
})
|
| 304 |
for part in candidate.content.parts:
|
| 305 |
if part.function_call:
|
|
|
|
| 306 |
function_calls.append(part.function_call)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
if full_text.strip() != "":
|
| 308 |
messages.append({
|
| 309 |
"role": "assistant",
|
|
|
|
| 297 |
print(chunk)
|
| 298 |
for candidate in chunk.candidates:
|
| 299 |
if candidate.content and candidate.content.parts:
|
| 300 |
+
has_function_call = False
|
|
|
|
|
|
|
|
|
|
| 301 |
for part in candidate.content.parts:
|
| 302 |
if part.function_call:
|
| 303 |
+
has_function_call = True
|
| 304 |
function_calls.append(part.function_call)
|
| 305 |
+
if has_function_call:
|
| 306 |
+
function_call_requests.append({
|
| 307 |
+
"role": "function_call",
|
| 308 |
+
"content": repr(candidate.content),
|
| 309 |
+
})
|
| 310 |
if full_text.strip() != "":
|
| 311 |
messages.append({
|
| 312 |
"role": "assistant",
|