YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(chat): extend @mention regex to include hyphens so @last-week stays visible while typing (#2595)
Divanshu098ff83b395e
diff --git a/apps/screenpipe-app-tauri/components/__tests__/global-chat-mentions.test.ts b/apps/screenpipe-app-tauri/components/__tests__/global-chat-mentions.test.tsindex e9beee2be..2013d6539 100644--- a/apps/screenpipe-app-tauri/components/__tests__/global-chat-mentions.test.ts+++ b/apps/screenpipe-app-tauri/components/__tests__/global-chat-mentions.test.ts@@ -40,4 +40,19 @@ describe("global chat mentions", () => {expect(mentions.appName).toBe("Google Chrome");expect(mentions.cleanedInput).toBe("find notes");});++ it("handles @mention trigger with hyphens", () => {+ const regex = /@([\w-]*)$/;+ const match1 = "@last".match(regex);+ expect(match1).not.toBeNull();+ expect(match1![1]).toBe("last");++ const match2 = "@last-".match(regex);+ expect(match2).not.toBeNull();+ expect(match2![1]).toBe("last-");++ const match3 = "@last-week".match(regex);+ expect(match3).not.toBeNull();+ expect(match3![1]).toBe("last-week");+ });});diff --git a/apps/screenpipe-app-tauri/components/hooks/use-mention-system.ts b/apps/screenpipe-app-tauri/components/hooks/use-mention-system.tsindex 5c8c7f438..fed98f826 100644--- a/apps/screenpipe-app-tauri/components/hooks/use-mention-system.ts+++ b/apps/screenpipe-app-tauri/components/hooks/use-mention-system.ts@@ -135,7 +135,7 @@ export function useMentionSystem(opts: {const cursorPos = e.target.selectionStart || 0;const textBeforeCursor = value.slice(0, cursorPos);- const atMatch = textBeforeCursor.match(/@(\w*)$/);+ const atMatch = textBeforeCursor.match(/@([\w-]*)$/);if (atMatch) {setShowMentionDropdown(true);diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsxindex 1e353442b..d97c7e15e 100644--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx@@ -1401,7 +1401,7 @@ export function StandaloneChat({ className }: { className?: string } = {}) {const cursorPos = e.target.selectionStart || 0;const textBeforeCursor = value.slice(0, cursorPos);- const atMatch = textBeforeCursor.match(/@(\w*)$/);+ const atMatch = textBeforeCursor.match(/@([\w-]*)$/);if (atMatch) {setShowMentionDropdown(true);