File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 25162516 }
25172517 }
25182518
2519- // Parse skill mentions ( <$skillId|label>) from user messages
2520- const skillMentionRegex = / < \$ ( [ ^ |>] + ) \| ? [ ^ >] * > / g ;
2519+ // Menu-selected skills are sent as IDs; inline <$skillId|label> mentions stay
2520+ // in the message so the backend can inject their full content.
25212521 const skillIds = [... selectedSkillIds ];
2522- const mentionSkillIds = [];
2523- for (const message of messages ) {
2524- const content =
2525- typeof message .content === ' string' ? message .content : (message .content ?.[0 ]?.text ?? ' ' );
2526- for (const match of content .matchAll (skillMentionRegex )) {
2527- if (! mentionSkillIds .includes (match [1 ])) {
2528- mentionSkillIds .push (match [1 ]);
2529- }
2530- if (! skillIds .includes (match [1 ])) {
2531- skillIds .push (match [1 ]);
2532- }
2533- }
2534- }
2535-
2536- // Strip skill mentions from message content
2537- if (mentionSkillIds .length > 0 ) {
2538- messages = messages .map ((message ) => {
2539- if (typeof message .content === ' string' ) {
2540- return {
2541- ... message ,
2542- content: message .content .replace (/ <\$ [^ >] + >/ g , ' ' ).trim ()
2543- };
2544- } else if (Array .isArray (message .content )) {
2545- return {
2546- ... message ,
2547- content: message .content .map ((part ) =>
2548- part .type === ' text'
2549- ? { ... part , text: part .text .replace (/ <\$ [^ >] + >/ g , ' ' ).trim () }
2550- : part
2551- )
2552- };
2553- }
2554- return message ;
2555- });
2556- }
25572522
25582523 // Use the user-selected terminal from the dropdown
25592524 const activeTerminalId = $selectedTerminalId ?? null ;
You can’t perform that action at this time.
0 commit comments