refac
This commit is contained in:
1 parent
a32a17965c
commit
653562d660
2 files changed
+6
-4
No files matched your search
@@ -1547,6 +1547,8 @@ async def chat_completion(
|
|||||||
for entry in message_ids:
|
for entry in message_ids:
|
||||||
target_model_id = entry['model_id']
|
target_model_id = entry['model_id']
|
||||||
assistant_message_id = entry['message_id']
|
assistant_message_id = entry['message_id']
|
||||||
|
if assistant_message_id and assistant_message_id == metadata.get('assistant_message_id'):
|
||||||
|
continue
|
||||||
if assistant_message_id:
|
if assistant_message_id:
|
||||||
assistant_message = {
|
assistant_message = {
|
||||||
'id': assistant_message_id,
|
'id': assistant_message_id,
|
||||||
|
|||||||
@@ -5165,7 +5165,7 @@ async def streaming_chat_response_handler(response, ctx):
|
|||||||
await pause_for_tool_approval(
|
await pause_for_tool_approval(
|
||||||
metadata['chat_id'],
|
metadata['chat_id'],
|
||||||
metadata['message_id'],
|
metadata['message_id'],
|
||||||
output,
|
full_output(),
|
||||||
form_data,
|
form_data,
|
||||||
metadata,
|
metadata,
|
||||||
)
|
)
|
||||||
@@ -5199,7 +5199,7 @@ async def streaming_chat_response_handler(response, ctx):
|
|||||||
await pause_for_tool_approval(
|
await pause_for_tool_approval(
|
||||||
metadata['chat_id'],
|
metadata['chat_id'],
|
||||||
metadata['message_id'],
|
metadata['message_id'],
|
||||||
output,
|
full_output(),
|
||||||
form_data,
|
form_data,
|
||||||
metadata,
|
metadata,
|
||||||
)
|
)
|
||||||
@@ -5478,7 +5478,7 @@ async def streaming_chat_response_handler(response, ctx):
|
|||||||
# output sent to the frontend — they're only for LLM consumption
|
# output sent to the frontend — they're only for LLM consumption
|
||||||
# via convert_output_to_messages.
|
# via convert_output_to_messages.
|
||||||
frontend_output = []
|
frontend_output = []
|
||||||
for item in output:
|
for item in full_output():
|
||||||
if item.get('type') == 'function_call_output':
|
if item.get('type') == 'function_call_output':
|
||||||
parts = item.get('output', [])
|
parts = item.get('output', [])
|
||||||
if any(p.get('type') == 'input_image' for p in parts):
|
if any(p.get('type') == 'input_image' for p in parts):
|
||||||
@@ -5564,7 +5564,7 @@ async def streaming_chat_response_handler(response, ctx):
|
|||||||
# keeps indices aligned. The display prefix
|
# keeps indices aligned. The display prefix
|
||||||
# ensures the UI shows tool history during
|
# ensures the UI shows tool history during
|
||||||
# streaming.
|
# streaming.
|
||||||
prior_output = list(output)
|
prior_output = list(full_output())
|
||||||
# Trim the trailing empty placeholder message
|
# Trim the trailing empty placeholder message
|
||||||
# so it doesn't persist as a ghost item once
|
# so it doesn't persist as a ghost item once
|
||||||
# the new stream produces real content.
|
# the new stream produces real content.
|
||||||
|
|||||||
Reference in new issue
Block a user