We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 67950e7 commit 6ab529cCopy full SHA for 6ab529c
1 file changed
astrbot/core/provider/sources/openai_source.py
@@ -316,9 +316,11 @@ async def _query_stream(
316
if not choice.delta or not choice.delta.tool_calls:
317
continue
318
for tool_call in choice.delta.tool_calls:
319
- if hasattr(tool_call, "type") and tool_call.type in (None, ""):
+ # 使用 getattr 处理 type 字段可能完全缺失的情况
320
+ tool_type = getattr(tool_call, "type", None)
321
+ if tool_type is None or tool_type == "":
322
logger.debug(
- f"[{self.get_model()}] tool_call.type is empty in chunk {chunk_index} "
323
+ f"[{self.get_model()}] tool_call.type is missing or empty in chunk {chunk_index} "
324
f"(provider: {self.provider_config.get('id', 'unknown')}), "
325
f"manually set to 'function'"
326
)
0 commit comments