Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita714cf4

Browse files
authored
Fix: Add empty checks for reasoning content arrays in stream handler (#1982)
1 parent4bc33e3 commita714cf4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/agents/models/chatcmpl_stream_handler.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ async def handle_stream(
150150
)
151151

152152
ifreasoning_contentandstate.reasoning_content_index_and_output:
153+
# Ensure summary list has at least one element
154+
ifnotstate.reasoning_content_index_and_output[1].summary:
155+
state.reasoning_content_index_and_output[1].summary= [
156+
Summary(text="",type="summary_text")
157+
]
158+
153159
yieldResponseReasoningSummaryTextDeltaEvent(
154160
delta=reasoning_content,
155161
item_id=FAKE_RESPONSES_ID,
@@ -201,7 +207,7 @@ async def handle_stream(
201207
)
202208

203209
# Create a new summary with updated text
204-
ifstate.reasoning_content_index_and_output[1].contentisNone:
210+
ifnotstate.reasoning_content_index_and_output[1].content:
205211
state.reasoning_content_index_and_output[1].content= [
206212
Content(text="",type="reasoning_text")
207213
]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp