fix: tolerate reasoning items without started_at when closing them at stream end (#28872)
This commit is contained in:
1 file changed
+4
-3
@@ -5262,9 +5262,10 @@ async def streaming_chat_response_handler(response, ctx):
|
|||||||
reasoning_item = output[-1]
|
reasoning_item = output[-1]
|
||||||
if reasoning_item.get('ended_at') is None:
|
if reasoning_item.get('ended_at') is None:
|
||||||
reasoning_item['ended_at'] = time.time()
|
reasoning_item['ended_at'] = time.time()
|
||||||
reasoning_item['duration'] = int(
|
if reasoning_item.get('started_at') is not None:
|
||||||
reasoning_item['ended_at'] - reasoning_item['started_at']
|
reasoning_item['duration'] = int(
|
||||||
)
|
reasoning_item['ended_at'] - reasoning_item['started_at']
|
||||||
|
)
|
||||||
reasoning_item['status'] = 'completed'
|
reasoning_item['status'] = 'completed'
|
||||||
|
|
||||||
if response_tool_calls:
|
if response_tool_calls:
|
||||||
|
|||||||
Reference in new issue
Block a user