fix: chat title shows raw skill syntax when it is named after the first message (#32176)

When a chat is named after its first message (title generation off, or the automatic title is blank), a message that starts with a skill picked by typing $ in the message box gave the chat a title like `<$tides-1234|Tides> when is high tide`. The title now shows each picked skill by its name, so the sidebar reads "Tides when is high tide".

Fixes #32019
This commit is contained in:
Classic298 2026-10-10 17:47:46 +02:00 • committed by GitHub
parent 92f283bba5
commit cdd96e5b57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -135,6 +135,7 @@ from open_webui.utils.skills import (
apply_skills_create_prompt,
extract_skill_ids_from_messages,
has_prior_user_message,
replace_skill_mentions_with_labels,
strip_skill_mentions,
)
from open_webui.utils.task import (
@ -3943,7 +3944,7 @@ async def background_tasks_handler(ctx):
title = ''
if not title:
title = messages[0].get('content', user_message)
title = replace_skill_mentions_with_labels(messages[0].get('content', user_message))
await Chats.update_chat_title_by_id(metadata['chat_id'], title)
@ -3955,7 +3956,7 @@ async def background_tasks_handler(ctx):
)
if title == None and len(messages) == 2 and (not messages_map or len(messages_map) <= 2):
title = messages[0].get('content', user_message)
title = replace_skill_mentions_with_labels(messages[0].get('content', user_message))
await Chats.update_chat_title_by_id(metadata['chat_id'], title)

View file

@ -32,6 +32,11 @@ def extract_skill_ids_from_messages(messages: list[dict]) -> set[str]:
SKILL_MENTION_STRIP_RE = re.compile(rf'<(?:\$({SKILL_ID_RE})(?:\|([^>]*))?|/({SKILL_ID_RE})\|([^>]*))>')
def replace_skill_mentions_with_labels(text: str) -> str:
"""Show labelled skill mentions as their label, for plain text such as chat titles."""
return SKILL_MENTION_STRIP_RE.sub(lambda match: match.group(2) or match.group(4) or match.group(0), text)
SKILLS_CREATE_RE = re.compile(r'^/skills:create(?:\s+(.*))?$', re.IGNORECASE | re.DOTALL)
OPEN_WEBUI_SKILL_AUTHORING_STANDARDS = """\