Skip to content

feat: improve @mention detection accuracy and performance - #23

Merged
BP602 merged 2 commits into
mainfrom
feat/improve-mention-detection
Sep 3, 2025
Merged

BP602 merged 2 commits into
mainfrom
feat/improve-mention-detection

Conversation

@BP602

@BP602 BP602 commented Sep 3, 2025

Copy link
Copy Markdown
Owner

Summary

  • Implements strict username-specific mention regex with proper word boundaries
  • Adds support for username variations (hyphens/underscores interchangeable)
  • Separates notification triggers for sound vs background highlighting
  • Adds regex memoization to improve performance
  • Fixes mention rendering to exclude boundary characters from highlights
  • Adds username variant lookup for clickable mentions

Changes Made

  • ChatProvider.jsx: Added cached mention regex with username-specific detection
  • Message.jsx: Memoized mention regex and improved highlight logic
  • MessageParser.jsx: Enhanced mention rendering and username variant handling
  • constants.js: Updated mention regex with better boundary enforcement
  • utils/regex.js: Added shared regex utility functions

Test Plan

  • Test @mention detection with various username formats
  • Verify hyphen/underscore username variations work correctly
  • Confirm notification settings are properly respected
  • Validate regex caching improves performance
  • Test mention highlighting excludes boundary characters

Fixes #14

 - Add strict username-specific mention regex with proper boundaries
 - Handle username variations with hyphens/underscores interchangeably
 - Separate notification triggers (sound vs background highlighting)
  - Memoize mention regex to avoid rebuilding on every message
 - Fix mention rendering to exclude boundary characters from highlight
 - Add username variant lookup for clickable mentions

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment thread src/renderer/src/providers/ChatProvider.jsx Outdated
  - Move mention regex logic to shared utils/regex.js with createMentionRegex()
  - Replace duplicate regex patterns in ChatProvider and Message.jsx
  - Fix notifications ignoring punctuation like @user! and @user?
  - Ensure consistent mention detection across notification and highlighting systems

  Addresses punctuation handling issue in codex comment
@BP602
BP602 merged commit 99a13c1 into main Sep 3, 2025
5 checks passed
@BP602
BP602 deleted the feat/improve-mention-detection branch September 10, 2025 17:26
ftk789 added a commit that referenced this pull request Oct 14, 2025
* Fix cross-platform icon compatibility

- Add cross-platform icon handling for Linux/macOS support
- Convert Windows .ico to .png for non-Windows platforms
- Update tray and thumbar icons to use platform-appropriate format

Fixes application crashes on Linux due to unsupported .ico format

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Implement draft message persistence between chatroom switches

- Add draft storage to ChatProvider state using Map for per-chatroom drafts
- Create DraftManager component to handle automatic saving and restoration
- Save draft content on editor changes using Lexical update listeners
- Restore draft content when switching back to chatrooms
- Clear drafts when messages are sent successfully
- Fix Lexical node structure by properly using paragraph nodes

Fixes #23

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: ftk789 <57598907+ftk789@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@ mention notifications not working - missing username detection logic

1 participant