Skip to content
Merged
Changes from 1 commit
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
12 changes: 9 additions & 3 deletions astrbot/core/provider/sources/openai_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,20 @@ async def _query_stream(
state = ChatCompletionStreamState()

async for chunk in stream:
choice = chunk.choices[0]
delta = choice.delta

# siliconflow workaround
if dtcs := delta.tool_calls:
for tc in dtcs:
if tc.function and tc.function.arguments:
tc.type = "function"
try:
state.handle_chunk(chunk)
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
except Exception as e:
logger.warning("Saving chunk state error: " + str(e))
logger.error("Saving chunk state error: " + str(e))
if not chunk.choices:
continue
Comment thread
Soulter marked this conversation as resolved.
Outdated
choice = chunk.choices[0]
delta = choice.delta
# logger.debug(f"chunk delta: {delta}")
# handle the content delta
reasoning = self._extract_reasoning_content(chunk)
Expand Down
Loading