Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: noz mention email (#13319)

Gaurav Tewari90db0e9bd720
diff --git a/frontend/src/container/AIAssistant/components/ChatInput/ChatInput.tsx b/frontend/src/container/AIAssistant/components/ChatInput/ChatInput.tsx
index f84df0aaa5..50a01eaca0 100644
--- a/frontend/src/container/AIAssistant/components/ChatInput/ChatInput.tsx
+++ b/frontend/src/container/AIAssistant/components/ChatInput/ChatInput.tsx
@@ -298,7 +298,8 @@ export default function ChatInput({
(value: string, caret: number) => {
const beforeCaret = value.slice(0, caret);
const atIndex = beforeCaret.lastIndexOf('@');
- if (atIndex < 0) {
+ // `@` only triggers at a word start, so words containing `@` stay plain text.
+ if (atIndex < 0 || /\S/.test(beforeCaret.charAt(atIndex - 1))) {
setIsContextPickerOpen(false);
setMentionRange(null);
return;
diff --git a/frontend/src/container/AIAssistant/components/ChatInput/__tests__/ChatInput.mention.test.tsx b/frontend/src/container/AIAssistant/components/ChatInput/__tests__/ChatInput.mention.test.tsx
new file mode 100644
index 0000000000..67da7dade7
--- /dev/null
+++ b/frontend/src/container/AIAssistant/components/ChatInput/__tests__/ChatInput.mention.test.tsx
@@ -0,0 +1,30 @@
+import { render, screen, userEvent } from 'tests/test-utils';
+
+import ChatInput from '../ChatInput';
+
+function getComposer(): HTMLTextAreaElement {
+ return screen.getByPlaceholderText(/Ask anything/i) as HTMLTextAreaElement;
+}
+
+describe('ChatInput — @ mention trigger', () => {
+ it('opens the context picker when @ starts a word', async () => {
+ render(<ChatInput onSend={jest.fn()} />);
+
+ await userEvent.type(getComposer(), 'check @');
+
+ await expect(
+ screen.findByPlaceholderText(/search dashboards/i),
+ ).resolves.toBeInTheDocument();
+ });
+
+ it('keeps typing an email without opening the context picker', async () => {
+ render(<ChatInput onSend={jest.fn()} />);
+
+ await userEvent.type(getComposer(), 'mail [email protected]');
+
+ expect(getComposer()).toHaveValue('mail [email protected]');
+ expect(
+ screen.queryByPlaceholderText(/search dashboards/i),
+ ).not.toBeInTheDocument();
+ });
+});