fix: tolerate reasoning items without started_at when closing them at stream end (#28872)

This commit is contained in:
G30
2026-08-21 15:51:21 -07:00
committed by GitHub
parent dcff244f9e
commit 883c7434fb
+4 -3
View File
@@ -5262,9 +5262,10 @@ async def streaming_chat_response_handler(response, ctx):
reasoning_item = output[-1]
if reasoning_item.get('ended_at') is None:
reasoning_item['ended_at'] = time.time()
reasoning_item['duration'] = int(
reasoning_item['ended_at'] - reasoning_item['started_at']
)
if reasoning_item.get('started_at') is not None:
reasoning_item['duration'] = int(
reasoning_item['ended_at'] - reasoning_item['started_at']
)
reasoning_item['status'] = 'completed'
if response_tool_calls: