Skip to content

Conversation

hllshiro
Copy link
Collaborator

@hllshiro hllshiro commented Aug 5, 2025

Pull Request Description (中文)

你的功能请求是否与某个问题有关?请描述一下。
请对问题进行清晰扼要的描述。
增加 deeplink 协议中 start 对 mention 的支持。

请描述你希望的解决方案

mention.mp4

平台兼容性注意事项
如果此 PR 具有特定的平台兼容性考虑因素(Windows、macOS、Linux),请在此处描述。

  • 是否有任何平台特定的行为或代码调整?无
  • 你是否已在所有相关平台上进行过测试?仅windows

Summary by CodeRabbit

  • New Features
    • Added support for extracting and handling "mentions" from deeplink URLs, allowing mentions to be pre-filled in chat input when opening the app via a deeplink.
    • Enhanced chat input to allow programmatic insertion of mentions and text, supporting new methods to clear content, append text, and append mentions.
  • Improvements
    • Chat input now prioritizes inserting mentions before message text when restoring cached deeplink data, ensuring a more accurate message composition experience.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Walkthrough

This change introduces support for handling a new mentions parameter in the deeplink workflow. The backend parses and forwards mentions to the renderer, which caches them and updates the chat input to programmatically insert mentions alongside message text. The ChatInput component gains new public methods for appending text and mentions.

Changes

Cohort / File(s) Change Summary
Deeplink Presenter: Mentions Extraction
src/main/presenter/deeplinkPresenter/index.ts
The handleStart method now parses a mentions parameter from URL search params, splits it into an array, and includes it in the event payload sent to the renderer.
Chat Store: Mentions Caching
src/renderer/src/stores/chat.ts
The deeplinkCache state adds an optional mentions array, which is populated when receiving the relevant event.
ChatInput Component: Programmatic Mentions
src/renderer/src/components/ChatInput.vue
Adds methods to programmatically insert mentions and text into the editor. Exposes clearContent, appendText, and appendMention methods. Handles post-insert logic for prompt-type mentions.
NewThread Component: Applying Mentions
src/renderer/src/components/NewThread.vue
Updates the watcher for deeplink cache to clear input, insert mentions, and append message text in order, using the new ChatInput API.

Sequence Diagram(s)

sequenceDiagram
    participant Deeplink as DeeplinkPresenter
    participant Renderer as Renderer Process
    participant Store as Chat Store
    participant ChatInput as ChatInput Component
    participant User as User

    Deeplink->>Renderer: handleStart(params) with {msg, mentions, ...}
    Renderer->>Store: Store {msg, mentions, ...} in deeplinkCache
    Store->>ChatInput: (via NewThread watcher) clearContent()
    Store->>ChatInput: appendMention(mention) for each mention
    Store->>ChatInput: appendText(msg)
    User->>ChatInput: (sees mentions and message prefilled)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • zerob13

Poem

🐇
Mentions now hop into chat with glee,
Arriving by deeplink, as easy as can be.
With new methods to guide them and text to append,
The chat grows smarter—on rabbits you can depend!
🥕✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3be73f6 and c4cb12c.

📒 Files selected for processing (2)
  • src/main/presenter/deeplinkPresenter/index.ts (2 hunks)
  • src/renderer/src/components/ChatInput.vue (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/components/ChatInput.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-check (x64)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/renderer/src/components/ChatInput.vue (1)

1024-1032: Consider performance optimization for mention search.

The linear search works for small datasets, but consider using a Map or index for better performance if mention lists grow large.

+// Consider adding this as a computed property for better performance
+const mentionDataMap = computed(() => {
+  const map = new Map<string, CategorizedData>()
+  mentionData.value.forEach(item => {
+    if (item.type === 'item') {
+      map.set(item.label, item)
+      map.set(item.id, item)
+    }
+  })
+  return map
+})

 const findMentionByName = (name: string): CategorizedData | null => {
-  // 在当前的mentionData中查找匹配的项目
-  const foundMention = mentionData.value.find(item => 
-    item.type === 'item' && 
-    (item.label === name || item.id === name)
-  )
-  
-  return foundMention || null
+  return mentionDataMap.value.get(name) || null
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e1e276 and 3be73f6.

📒 Files selected for processing (4)
  • src/main/presenter/deeplinkPresenter/index.ts (2 hunks)
  • src/renderer/src/components/ChatInput.vue (3 hunks)
  • src/renderer/src/components/NewThread.vue (1 hunks)
  • src/renderer/src/stores/chat.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (16)
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Use English for logs and comments

Files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/components/ChatInput.vue
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Strict type checking enabled for TypeScript

**/*.{ts,tsx}: 始终使用 try-catch 处理可能的错误
提供有意义的错误信息
记录详细的错误日志
优雅降级处理
日志应包含时间戳、日志级别、错误代码、错误描述、堆栈跟踪(如适用)、相关上下文信息
日志级别应包括 ERROR、WARN、INFO、DEBUG
不要吞掉错误
提供用户友好的错误信息
实现错误重试机制
避免记录敏感信息
使用结构化日志
设置适当的日志级别

Files:

  • src/renderer/src/stores/chat.ts
  • src/main/presenter/deeplinkPresenter/index.ts
src/renderer/src/**/*.{ts,tsx,vue}

📄 CodeRabbit Inference Engine (CLAUDE.md)

src/renderer/src/**/*.{ts,tsx,vue}: Use Pinia for frontend state management
Renderer to Main: Use usePresenter.ts composable for direct presenter method calls

Files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development-setup.mdc)

**/*.{js,jsx,ts,tsx}: 使用 OxLint 进行代码检查
Log和注释使用英文书写

Files:

  • src/renderer/src/stores/chat.ts
  • src/main/presenter/deeplinkPresenter/index.ts
src/{main,renderer}/**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/electron-best-practices.mdc)

src/{main,renderer}/**/*.ts: Use context isolation for improved security
Implement proper inter-process communication (IPC) patterns
Optimize application startup time with lazy loading
Implement proper error handling and logging for debugging

Files:

  • src/renderer/src/stores/chat.ts
  • src/main/presenter/deeplinkPresenter/index.ts
src/renderer/src/**/*

📄 CodeRabbit Inference Engine (.cursor/rules/i18n.mdc)

src/renderer/src/**/*: All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Use the 'vue-i18n' framework for all internationalization in the renderer
Ensure all user-visible text in the renderer uses the translation system

Files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/pinia-best-practices.mdc)

src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}: Use modules to organize related state and actions
Implement proper state persistence for maintaining data across sessions
Use getters for computed state properties
Utilize actions for side effects and asynchronous operations
Keep the store focused on global state, not component-specific data

Files:

  • src/renderer/src/stores/chat.ts
src/renderer/**/*.{vue,ts,js,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)

渲染进程代码放在 src/renderer

Files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/vue-best-practices.mdc)

src/renderer/src/**/*.{vue,ts,tsx,js,jsx}: Use the Composition API for better code organization and reusability
Implement proper state management with Pinia
Utilize Vue Router for navigation and route management
Leverage Vue's built-in reactivity system for efficient data handling

Files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
src/renderer/**/*.{ts,tsx,vue}

📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.

Files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
src/renderer/**/*.{vue,ts}

📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)

Implement lazy loading for routes and components.

Files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
src/renderer/**/*.{ts,vue}

📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.

Files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
src/renderer/src/**/*.vue

📄 CodeRabbit Inference Engine (CLAUDE.md)

src/renderer/src/**/*.vue: Use Composition API for all Vue 3 components
Use Tailwind CSS with scoped styles for styling
Organize components by feature in src/renderer/src/
Follow existing component patterns in src/renderer/src/ when creating new UI components
Use Composition API with proper TypeScript typing for new UI components
Implement responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states for new UI components

Use scoped styles to prevent CSS conflicts between components

Files:

  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
src/main/**/*.ts

📄 CodeRabbit Inference Engine (CLAUDE.md)

Main to Renderer: Use EventBus to broadcast events via mainWindow.webContents.send()

Use Electron's built-in APIs for file system and native dialogs

Files:

  • src/main/presenter/deeplinkPresenter/index.ts
src/main/presenter/**/*.ts

📄 CodeRabbit Inference Engine (CLAUDE.md)

One presenter per functional domain

Files:

  • src/main/presenter/deeplinkPresenter/index.ts
src/main/**/*.{ts,js,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)

主进程代码放在 src/main

Files:

  • src/main/presenter/deeplinkPresenter/index.ts
🧠 Learnings (27)
📚 Learning: in src/renderer/src/stores/chat.ts, the user prefers to keep both `text` and `content` properties in...
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/renderer/src/stores/chat.ts:1011-1035
Timestamp: 2025-06-21T15:49:17.044Z
Learning: In src/renderer/src/stores/chat.ts, the user prefers to keep both `text` and `content` properties in the `handleMeetingInstruction` function's `sendMessage` call, even though they are redundant, rather than removing the `content` property.

Applied to files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/stores/**/*.ts : use pinia for state management....
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/stores/**/*.ts : Use Pinia for state management.

Applied to files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : implement proper state persistence for...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.479Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions

Applied to files:

  • src/renderer/src/stores/chat.ts
  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : implement proper state management with pinia...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:28.817Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Implement proper state management with Pinia

Applied to files:

  • src/renderer/src/stores/chat.ts
📚 Learning: applies to src/renderer/src/**/*.{ts,tsx,vue} : use pinia for frontend state management...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.{ts,tsx,vue} : Use Pinia for frontend state management

Applied to files:

  • src/renderer/src/stores/chat.ts
📚 Learning: applies to src/renderer/**/*.{vue} : leverage ref, reactive, and computed for reactive state managem...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Leverage ref, reactive, and computed for reactive state management.

Applied to files:

  • src/renderer/src/components/NewThread.vue
📚 Learning: applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : leverage vue's built-in reactivity system for...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:28.817Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Leverage Vue's built-in reactivity system for efficient data handling

Applied to files:

  • src/renderer/src/components/NewThread.vue
📚 Learning: applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : use the composition api for better code organ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:28.817Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Use the Composition API for better code organization and reusability

Applied to files:

  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/**/*.{vue} : use template syntax for declarative rendering....
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use template syntax for declarative rendering.

Applied to files:

  • src/renderer/src/components/NewThread.vue
📚 Learning: applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : utilize actions for side effects and a...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.479Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Utilize actions for side effects and asynchronous operations

Applied to files:

  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : keep the store focused on global state...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.479Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Keep the store focused on global state, not component-specific data

Applied to files:

  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/**/*.{vue} : use composition api and declarative programming patterns; avoid...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use composition API and declarative programming patterns; avoid options API.

Applied to files:

  • src/renderer/src/components/NewThread.vue
📚 Learning: applies to src/renderer/src/**/*.vue : use composition api with proper typescript typing for new ui ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.vue : Use Composition API with proper TypeScript typing for new UI components

Applied to files:

  • src/renderer/src/components/NewThread.vue
  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/main/presenter/llmproviderpresenter/index.ts : `src/main/presenter/llmproviderpresent...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : `src/main/presenter/llmProviderPresenter/index.ts` should manage the overall Agent loop, conversation history, tool execution via `McpPresenter`, and frontend communication via `eventBus`.

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/src/**/*.{ts,tsx,vue} : renderer to main: use usepresenter.ts composable for...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.{ts,tsx,vue} : Renderer to Main: Use usePresenter.ts composable for direct presenter method calls

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: applies to src/renderer/src/composables/usepresenter.ts : the ipc in the renderer process is impleme...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:45:54.229Z
Learning: Applies to src/renderer/src/composables/usePresenter.ts : The IPC in the renderer process is implemented in usePresenter.ts, allowing direct calls to the presenter-related interfaces exposed by the main process

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/index.ts : the main agent loop should buffer text...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop should buffer text content, handle tool call events, format tool results for the next LLM call, and manage conversation continuation logic.

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: applies to src/main/presenter/configpresenter/**/*.ts : centralize configuration in configpresenter/...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/configPresenter/**/*.ts : Centralize configuration in configPresenter/

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: applies to src/main/presenter/mcppresenter/index.ts : register new mcp tool in mcppresenter/index.ts...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/main/presenter/llmproviderpresenter/index.ts : the main agent loop in `llmproviderpre...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop in `llmProviderPresenter/index.ts` should handle multi-round LLM calls and tool usage, maintaining conversation state and controlling the loop with `needContinueConversation` and `toolCallCount`.

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/index.ts : the main agent loop should send standa...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop should send standardized `STREAM_EVENTS` (`RESPONSE`, `END`, `ERROR`) to the frontend via `eventBus`.

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: applies to src/main/presenter/**/*.ts : one presenter per functional domain...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/**/*.ts : One presenter per functional domain

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/providers/*.ts : provider files should implement ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should implement helper methods such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed for provider-specific logic.

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: applies to src/renderer/**/*.{vue} : use <script setup> syntax for concise component definitions....
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use <script setup> syntax for concise component definitions.

Applied to files:

  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/src/**/*.vue : add proper error handling and loading states for new ui compo...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.vue : Add proper error handling and loading states for new UI components

Applied to files:

  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : use modules to organize related state ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.479Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use modules to organize related state and actions

Applied to files:

  • src/renderer/src/components/ChatInput.vue
📚 Learning: applies to src/renderer/**/*.{ts,vue} : use usefetch and useasyncdata for data fetching....
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{ts,vue} : Use useFetch and useAsyncData for data fetching.

Applied to files:

  • src/renderer/src/components/ChatInput.vue
🔇 Additional comments (8)
src/main/presenter/deeplinkPresenter/index.ts (1)

212-212: LGTM!

The mentions parameter is correctly included in the event payload, following the same pattern as other deeplink parameters.

src/renderer/src/stores/chat.ts (2)

69-69: LGTM!

The optional mentions property is correctly typed as string[] and follows the established pattern of other optional properties in the deeplinkCache interface.


960-960: LGTM!

The mentions assignment follows the established pattern of storing deeplink parameters in the cache, maintaining consistency with other cached properties.

src/renderer/src/components/NewThread.vue (1)

305-317: ChatInput methods confirmed and logic approved

The clearContent, appendMention, and appendText methods are all properly defined in src/renderer/src/components/ChatInput.vue, so the watcher logic in NewThread.vue can safely clear and populate the editor as intended. No further changes needed.

src/renderer/src/components/ChatInput.vue (4)

205-205: LGTM! Import additions are well-structured.

The new imports are properly typed and necessary for the enhanced mention functionality. Good use of TypeScript type imports for better type safety.

Also applies to: 216-217


1035-1067: Well-implemented TipTap integration with good error handling.

The mention insertion logic correctly uses TipTap's chain API and maintains proper state synchronization. The automatic space insertion is a good UX touch.


1070-1085: Excellent async error handling and type safety.

The post-insertion logic is well-structured with proper type guards, async error handling, and integration with existing prompt file handlers.


1104-1131: Excellent async API design with comprehensive error handling.

The appendMention method is well-structured with proper error handling, meaningful return values, and good integration with the utility functions. The async nature appropriately handles the complexity of mention insertion and post-processing.

Comment on lines +1088 to +1103
clearContent: () => {
inputText.value = ''
editor.chain().clearContent().run()
editor.view.updateState(editor.state)
},
appendText: (text: string) => {
inputText.value += text
nextTick(() => {
editor.chain().clearContent().insertContent(text).run()
editor.chain().insertContent(text).run()
editor.view.updateState(editor.state)
setTimeout(() => {
const docSize = editor.state.doc.content.size
editor.chain().focus().setTextSelection(docSize).run()
}, 10)
})
},
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Review the text appending logic for potential reactivity issues.

The appendText method directly modifies inputText.value before updating the editor, which might cause reactivity inconsistencies.

Consider letting TipTap manage the text state and sync back to inputText:

 appendText: (text: string) => {
-  inputText.value += text
   nextTick(() => {
     editor.chain().insertContent(text).run()
+    inputText.value = editor.getText()
     editor.view.updateState(editor.state)
     setTimeout(() => {
       const docSize = editor.state.doc.content.size
       editor.chain().focus().setTextSelection(docSize).run()
     }, 10)
   })
 },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
clearContent: () => {
inputText.value = ''
editor.chain().clearContent().run()
editor.view.updateState(editor.state)
},
appendText: (text: string) => {
inputText.value += text
nextTick(() => {
editor.chain().clearContent().insertContent(text).run()
editor.chain().insertContent(text).run()
editor.view.updateState(editor.state)
setTimeout(() => {
const docSize = editor.state.doc.content.size
editor.chain().focus().setTextSelection(docSize).run()
}, 10)
})
},
appendText: (text: string) => {
nextTick(() => {
editor.chain().insertContent(text).run()
inputText.value = editor.getText()
editor.view.updateState(editor.state)
setTimeout(() => {
const docSize = editor.state.doc.content.size
editor.chain().focus().setTextSelection(docSize).run()
}, 10)
})
},
🤖 Prompt for AI Agents
In src/renderer/src/components/ChatInput.vue between lines 1088 and 1103, the
appendText method directly modifies inputText.value before updating the editor,
which can cause reactivity issues. To fix this, avoid directly changing
inputText.value; instead, update the editor content first using TipTap's API,
then sync the editor's content back to inputText.value to keep the state
consistent and reactive.

@zerob13 zerob13 merged commit 946ae12 into ThinkInAIXYZ:dev Aug 5, 2025
2 checks passed
zerob13 added a commit that referenced this pull request Aug 6, 2025
* fix: prevent tooltip from overlapping HTML preview in ArtifactDialog (#683)

* fix: unwatch is not a function error in knowledge settings components (#684)

* fix: resolve message editing and markdown rendering issues (#685)

* docs: update Electron-Vite link format to full URL (#687)

* fix: built-in knowledge settings not loaded when first entering (#688)

* fix: enhance lifecycle management by adding unmounted hook and MCP state watcher

* fix: improve knowledge destruction confirmation and enhance unwatch handling in settings

* fix: resolve database lock issue in data reset functionality (#689)

* feat: implement provider-based request rate limit (#686)

* feat: implement provider-based request rate limit

* feat: add input validation with confirmation dialog

* refactor: merge RateLimitPresenter into LLMProviderPresenter

* Optimize/builtin knowledge interaction (#690)

* feat: improve builtInKnowledge file icon style

* feat: add builtInKnowledge resume icon tooltip

* feat: format code

* Update src/renderer/src/i18n/fa-IR/settings.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update src/renderer/src/i18n/ja-JP/settings.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update src/renderer/src/i18n/fr-FR/settings.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update settings.json

* Update src/renderer/src/i18n/fr-FR/settings.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: Fix French and Korean translations for pause and delete file confirmation messages

---------

Co-authored-by: sqsyli <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: fixed dirty data problems (#691)

fixed the old session tool error caused by
fixed the problem that the tool list was not reset when creating a new session

* feat: add mentions support in deeplink (#692)

* feat: add mentions support in chat input and store

* style: format imports and clean up code for better readability

* fix: improve mentions handling in handleStart method

* fix: prompt attach files (#695)

* fix: update file icon handling and improve file upload process

* fix: remove redundant FileItem interface definition in PromptSetting.vue

* fix: implement confirmation dialog for prompt deletion in PromptSetting.vue

* fix: streamline file upload process by removing redundant file content reading logic

* feat: add npm registry caching and optimization system (#697)

* fix: resolve input focus loss issue after sending messages (#694)

* fix: resolve deeplink message not displaying when triggered from settings page (#699)

* fix: update current tools assignment to include tool names when MCP tools are not enabled (#698)

* feat: add support for new models  (#700)

* chore: update ollama model settings

* chore: add support for gpt-oss

* chore: bump to 0.2.9

* fix: refine #698 (#701)

* fix: update current tools assignment to include tool names when MCP tools are not enabled

* fix: update enabled MCP tools assignment to include tool names on session switch

* feat: add Claude Opus 4.1 support and fix anthropic model list dialog (#702)

---------

Co-authored-by: yyhhyyyyyy <[email protected]>
Co-authored-by: cycleccc <[email protected]>
Co-authored-by: hllshiro <[email protected]>
Co-authored-by: sqsyli <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@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.

2 participants