修复错误代码
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
@@ -410,7 +411,11 @@ class Gemini(Platform):
|
|||||||
text = part.get("text", "")
|
text = part.get("text", "")
|
||||||
if text:
|
if text:
|
||||||
yield text
|
yield text
|
||||||
if candidate.get("finishReason"):
|
finish_reason = candidate.get("finishReason")
|
||||||
|
if finish_reason:
|
||||||
|
logging.getLogger("instance/aibot").debug(
|
||||||
|
f"Gemini stream finished: finishReason={finish_reason}"
|
||||||
|
)
|
||||||
break
|
break
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user