This commit is contained in:
Timothy Jaeryang Baek
2026-06-29 05:39:17 -05:00
parent 396d9ac181
commit e6d35fc4cc
+2 -37
View File
@@ -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;