Skip to content

Commit bcd84dc

Browse files
Switch to slash commands
Switch chat trigger from @ to / for tool/skill invocations in UnifiedChatInput. Updated command handling to use slash-based mentions and adjusted matching logic accordingly. This enables triggering skills with /command syntax across the UI. X-Lovable-Edit-ID: edt-a9ffa2e3-ec4c-4c38-8b04-d7ae43e285e6 Co-authored-by: magnusfroste <38864257+magnusfroste@users.noreply.github.com>
2 parents bce2bf3 + db1862e commit bcd84dc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/components/chat/UnifiedChatInput.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ export function UnifiedChatInput({
117117
}, [value, attachedFile, isLoading, disabled, onSend]);
118118

119119
const handleCommandSelect = useCallback((command: string) => {
120-
const atIndex = value.lastIndexOf('@');
121-
const before = atIndex >= 0 ? value.slice(0, atIndex) : value;
122-
const newValue = `${before}@${command} `;
120+
const slashIndex = value.lastIndexOf('/');
121+
const before = slashIndex >= 0 ? value.slice(0, slashIndex) : value;
122+
const newValue = `${before}/${command} `;
123123
setValue(newValue);
124124
setShowPalette(false);
125125
setCommandFilter('');
@@ -132,11 +132,11 @@ export function UnifiedChatInput({
132132

133133
const cursorPos = e.target.selectionStart;
134134
const textBeforeCursor = newValue.slice(0, cursorPos);
135-
const atMatch = textBeforeCursor.match(/@(\w*)$/);
135+
const slashMatch = textBeforeCursor.match(/\/(\w*)$/);
136136

137-
if (atMatch) {
137+
if (slashMatch) {
138138
setShowPalette(true);
139-
setCommandFilter(atMatch[1]);
139+
setCommandFilter(slashMatch[1]);
140140
} else {
141141
setShowPalette(false);
142142
setCommandFilter('');

0 commit comments

Comments
 (0)