Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions astrbot/core/provider/sources/openai_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,14 @@ async def _query_stream(
state = ChatCompletionStreamState()

async for chunk in stream:
# Fix for #6661: Add missing 'index' field to tool_call deltas
# Gemini and some OpenAI-compatible proxies omit this field
if chunk.choices:
for choice in chunk.choices:
if choice.delta and choice.delta.tool_calls:
for idx, tc in enumerate(choice.delta.tool_calls):
if not hasattr(tc, "index") or tc.index is None:
Comment thread
Soulter marked this conversation as resolved.
Outdated
tc.index = idx
try:
state.handle_chunk(chunk)
except Exception as e:
Expand Down