fix: tolerate reasoning items without started_at when closing them at stream end (#28872)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user