mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-07 02:58:21 +00:00
fix review notes
This commit is contained in:
parent
3064a73f16
commit
4f12b14e9a
2 changed files with 25 additions and 6 deletions
|
|
@ -2549,8 +2549,18 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||
if mcp_server_connection.get('config', {}).get('forward_mcp_instructions', True):
|
||||
mcp_instr = mcp_clients[server_id].server_instructions
|
||||
if mcp_instr:
|
||||
mcp_info = mcp_server_connection.get('info', {}) or {}
|
||||
mcp_attr_id = mcp_info.get('id', '') or server_id
|
||||
mcp_attr_name = mcp_info.get('name', '') or mcp_attr_id
|
||||
safe_instr = mcp_instr.replace(']]>', ']]]]><![CDATA[>')
|
||||
wrapped_instr = (
|
||||
f'<mcp_instructions server="{html.escape(mcp_attr_id, quote=True)}"'
|
||||
f' name="{html.escape(mcp_attr_name, quote=True)}">'
|
||||
f'<![CDATA[{safe_instr}]]>'
|
||||
f'</mcp_instructions>'
|
||||
)
|
||||
form_data['messages'] = add_or_update_system_message(
|
||||
mcp_instr,
|
||||
wrapped_instr,
|
||||
form_data['messages'],
|
||||
append=True,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -223,10 +223,12 @@
|
|||
}
|
||||
|
||||
if (data.config) {
|
||||
enable = data.config.enable ?? true;
|
||||
accessGrants = data.config.access_grants ?? [];
|
||||
if (data.config.forward_mcp_instructions !== undefined) {
|
||||
forwardMcpInstructions = data.config.forward_mcp_instructions;
|
||||
const c = data.config;
|
||||
if ('enable' in c) enable = c.enable;
|
||||
if ('access_grants' in c) accessGrants = c.access_grants ?? [];
|
||||
if ('forward_mcp_instructions' in c) forwardMcpInstructions = c.forward_mcp_instructions;
|
||||
if ('function_name_filter_list' in c) {
|
||||
functionNameFilterList = c.function_name_filter_list ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +261,14 @@
|
|||
description: description
|
||||
},
|
||||
...(type === 'mcp'
|
||||
? { config: { forward_mcp_instructions: forwardMcpInstructions } }
|
||||
? {
|
||||
config: {
|
||||
enable,
|
||||
function_name_filter_list: functionNameFilterList,
|
||||
access_grants: accessGrants,
|
||||
forward_mcp_instructions: forwardMcpInstructions
|
||||
}
|
||||
}
|
||||
: {})
|
||||
}
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue