mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-18 04:43:55 +00:00
refac
This commit is contained in:
parent
7c3980338b
commit
5cf7c03332
2 changed files with 7 additions and 10 deletions
|
|
@ -2453,18 +2453,15 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||
# Otherwise, save any tools that filter inlets added for merging later.
|
||||
inlet_filter_tools = None if payload_tools is not None else form_data.get('tools', None)
|
||||
|
||||
# Mentioned skills get bounded content; selected/default skills can be loaded through view_skill.
|
||||
# Selected and mentioned skills get bounded content; other skills remain available through view_skill.
|
||||
chat_context = metadata.get('chat_context') or {}
|
||||
metadata['chat_context'] = chat_context
|
||||
skill_versions = chat_context.setdefault('skill_versions', {})
|
||||
mentioned_skill_ids = set(chat_context.get('mentioned_skill_ids') or []) | extract_skill_ids_from_messages(
|
||||
form_data.get('messages', [])
|
||||
)
|
||||
skill_ids = sorted(
|
||||
set(form_data.pop('skill_ids', None) or [])
|
||||
| set(model.get('info', {}).get('meta', {}).get('skillIds', []))
|
||||
| mentioned_skill_ids
|
||||
)
|
||||
activated_skill_ids = set(form_data.pop('skill_ids', None) or []) | mentioned_skill_ids
|
||||
skill_ids = sorted(activated_skill_ids | set(model.get('info', {}).get('meta', {}).get('skillIds', [])))
|
||||
available_skills = []
|
||||
terminal_skills = []
|
||||
if is_note_chat:
|
||||
|
|
@ -2519,7 +2516,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||
|
||||
skill_manifest = ''
|
||||
for skill in available_skills:
|
||||
if skill.id in mentioned_skill_ids or not use_builtin_tools or not model_builtin_tools.get('skills', True):
|
||||
if skill.id in activated_skill_ids or not use_builtin_tools or not model_builtin_tools.get('skills', True):
|
||||
from open_webui.models.skills import get_skill_snapshot
|
||||
|
||||
version_id = skill_versions.get(skill.id) or skill.version_id
|
||||
|
|
@ -2574,7 +2571,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||
|
||||
for skill in terminal_skills:
|
||||
sid = skill['id']
|
||||
if sid in mentioned_skill_ids or not use_builtin_tools or not model_builtin_tools.get('skills', True):
|
||||
if sid in activated_skill_ids or not use_builtin_tools or not model_builtin_tools.get('skills', True):
|
||||
skill_name = unquote(sid.removeprefix(terminal_skill_prefix))
|
||||
loaded = await get_terminal_skill(
|
||||
request,
|
||||
|
|
|
|||
|
|
@ -4288,8 +4288,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Menu-selected skills are sent as IDs; inline <$skillId|label> mentions stay
|
||||
// in the message so the backend can inject their full content.
|
||||
// Menu-selected skills and inline <$skillId|label> mentions both load instructions.
|
||||
// Keep mentions in the message so the backend can resolve them.
|
||||
const skillIds = [...selectedSkillIds];
|
||||
|
||||
// Only send terminal_id if the model has terminal capability enabled
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue