fix: tolerate reasoning items without started_at when closing them at stream end (#28872)
This commit is contained in:
1 file changed
+1
@@ -5262,6 +5262,7 @@ 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()
|
||||||
|
if reasoning_item.get('started_at') is not None:
|
||||||
reasoning_item['duration'] = int(
|
reasoning_item['duration'] = int(
|
||||||
reasoning_item['ended_at'] - reasoning_item['started_at']
|
reasoning_item['ended_at'] - reasoning_item['started_at']
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user