refac
This commit is contained in:
1 parent
29f6c72e87
commit
02f9fe7890
1 file changed
+6
-3
@@ -2423,6 +2423,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||||||
form_data['files'] = files
|
form_data['files'] = files
|
||||||
|
|
||||||
variables = form_data.pop('variables', None)
|
variables = form_data.pop('variables', None)
|
||||||
|
payload_tools = form_data.get('tools', None) # snapshot before filters
|
||||||
|
|
||||||
# Process the form_data through the pipeline
|
# Process the form_data through the pipeline
|
||||||
try:
|
try:
|
||||||
@@ -2513,9 +2514,9 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||||||
files = form_data.pop('files', None)
|
files = form_data.pop('files', None)
|
||||||
form_data.pop('folder_id', None)
|
form_data.pop('folder_id', None)
|
||||||
|
|
||||||
# Caller-provided OpenAI-style tools take precedence over server-side
|
# If the original caller provided tools, use them as-is (skip resolution).
|
||||||
# tool resolution (tool_ids, MCP servers, builtin tools).
|
# Otherwise, save any tools that filter inlets added for merging later.
|
||||||
payload_tools = form_data.get('tools', None)
|
inlet_filter_tools = None if payload_tools else form_data.get('tools', None)
|
||||||
|
|
||||||
# Skills — extract IDs from message content (<$skillId|label> tags) so
|
# Skills — extract IDs from message content (<$skillId|label> tags) so
|
||||||
# persisted chats work without relying on the frontend to send skill_ids.
|
# persisted chats work without relying on the frontend to send skill_ids.
|
||||||
@@ -2824,6 +2825,8 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||||||
form_data['tools'] = [
|
form_data['tools'] = [
|
||||||
{'type': 'function', 'function': tool.get('spec', {})} for tool in tools_dict.values()
|
{'type': 'function', 'function': tool.get('spec', {})} for tool in tools_dict.values()
|
||||||
]
|
]
|
||||||
|
if inlet_filter_tools:
|
||||||
|
form_data['tools'].extend(inlet_filter_tools)
|
||||||
else:
|
else:
|
||||||
# If the function calling is not native, then call the tools function calling handler
|
# If the function calling is not native, then call the tools function calling handler
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in new issue
Block a user