diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index aa74ef915d..ec550fb61b 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -2516,44 +2516,9 @@ } } - // Parse skill mentions (<$skillId|label>) from user messages - const skillMentionRegex = /<\$([^|>]+)\|?[^>]*>/g; + // Menu-selected skills are sent as IDs; inline <$skillId|label> mentions stay + // in the message so the backend can inject their full content. const skillIds = [...selectedSkillIds]; - const mentionSkillIds = []; - for (const message of messages) { - const content = - typeof message.content === 'string' ? message.content : (message.content?.[0]?.text ?? ''); - for (const match of content.matchAll(skillMentionRegex)) { - if (!mentionSkillIds.includes(match[1])) { - mentionSkillIds.push(match[1]); - } - if (!skillIds.includes(match[1])) { - skillIds.push(match[1]); - } - } - } - - // Strip skill mentions from message content - if (mentionSkillIds.length > 0) { - messages = messages.map((message) => { - if (typeof message.content === 'string') { - return { - ...message, - content: message.content.replace(/<\$[^>]+>/g, '').trim() - }; - } else if (Array.isArray(message.content)) { - return { - ...message, - content: message.content.map((part) => - part.type === 'text' - ? { ...part, text: part.text.replace(/<\$[^>]+>/g, '').trim() } - : part - ) - }; - } - return message; - }); - } // Use the user-selected terminal from the dropdown const activeTerminalId = $selectedTerminalId ?? null;