Skip to content

Conversation

@zerob13
Copy link
Collaborator

@zerob13 zerob13 commented Jul 8, 2025

修复 Gemini 加载速度较慢的问题

Summary by CodeRabbit

  • New Features

    • Added a "Refresh Models" button in provider settings to manually update available models, with real-time status indication.
    • Enhanced model caching for improved performance and reduced latency.
    • UI now notifies users when model lists are refreshed or changed.
  • Improvements

    • Safety level settings for providers are more robust, preventing stale or incorrect values.
    • Gemini provider initialization now reliably updates the UI once models are ready.
    • Expanded and improved localization for safety settings and model refresh status in multiple languages.
  • Bug Fixes

    • Resolved issues with lingering or outdated safety level data when switching providers or updating settings.
  • Style

    • Minor code style adjustments for consistency (e.g., semicolon removal).
  • Chores

    • Updated localization files with new strings for risk blocking and model refresh actions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 8, 2025

Walkthrough

This update introduces an in-memory caching layer for model configuration management, synchronizes cache and persistent storage in all relevant operations, and provides explicit cache control. It also adds model refresh functionality to provider presenters, updates UI components to support model refreshing and improved safety level handling, and extends localization files with new strings for these features.

Changes

File(s) Change Summary
src/main/presenter/configPresenter/modelConfig.ts Added in-memory cache and cache initialization logic to ModelConfigHelper. All config read/write methods now synchronize with the cache. New method clearMemoryCache() added.
src/main/presenter/llmProviderPresenter/baseProvider.ts Enhanced BaseLLMProvider to initialize models from cache, synchronize custom model changes with config, and added a public refreshModels() method that fetches models and emits a UI event.
src/main/presenter/llmProviderPresenter/index.ts, src/shared/presenter.d.ts Added refreshModels(providerId: string): Promise<void> method to both the presenter class and its interface.
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts Added event dispatch after Gemini model initialization to notify UI of model list changes.
src/main/presenter/githubCopilotDeviceFlow.ts Removed trailing semicolons for code style consistency; no logic changes.
src/renderer/src/components/settings/GeminiSafetyConfig.vue Refactored safety level access to use accessor functions and improved reactivity and correctness in updating safety levels.
src/renderer/src/components/settings/ModelProviderSettingsDetail.vue Cleared Gemini safety levels before reinitialization, improved type safety, and ensured proper reactivity when passing safety levels to child components.
src/renderer/src/components/settings/ProviderApiConfig.vue Replaced "How to Get" button with a "Refresh Models" button, added loading state and refresh logic, removed provider website opening logic.
src/renderer/src/stores/settings.ts Made model refresh calls non-blocking by removing await from refresh function calls.
src/renderer/src/i18n/en-US/settings.json and other i18n JSONs (fa-IR, fr-FR, ja-JP, etc) Added new localization strings for safety levels and model refreshing status/messages in multiple languages.

Sequence Diagram(s)

sequenceDiagram
    participant UI as User Interface
    participant Renderer as Renderer Process
    participant Presenter as LLMProviderPresenter
    participant Provider as BaseLLMProvider
    participant Config as ModelConfigHelper

    UI->>Renderer: Click "Refresh Models"
    Renderer->>Presenter: refreshModels(providerId)
    Presenter->>Provider: refreshModels()
    Provider->>Provider: Fetch models from network
    Provider->>Config: Update model configs (sync cache & store)
    Provider->>Renderer: Emit MODEL_LIST_CHANGED event
    Renderer->>UI: Update model list display
Loading

Possibly related PRs

  • ThinkInAIXYZ/deepchat#516: Introduces the initial ModelConfigHelper class with persistent storage and config retrieval logic, which the current PR extends with in-memory caching and synchronization.

Poem

🐇✨
A cache now hops in memory bright,
Models refresh with a button’s light.
Safety levels clear and true,
Locales now greet in languages new.
With every hop, configs align—
The code is fresh, the models fine!
—Your code rabbit, on cloud nine.


📜 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 37423a7 and 23fc3d1.

📒 Files selected for processing (3)
  • src/main/presenter/llmProviderPresenter/index.ts (1 hunks)
  • src/renderer/src/i18n/ja-JP/settings.json (2 hunks)
  • src/renderer/src/i18n/zh-CN/settings.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/main/presenter/llmProviderPresenter/index.ts
⏰ 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

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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 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.

@zerob13 zerob13 marked this pull request as ready for review July 9, 2025 06:28
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: 4

🧹 Nitpick comments (4)
src/renderer/src/i18n/fa-IR/settings.json (2)

251-256: Refine Persian wording for the new safety options
The current strings mix Persian and English and sound unnatural. A tighter translation would be:

-"blockMost": "خطرات متوسط ​​را مسدود کنید",
+"blockMost": "مسدودسازی خطر متوسط",
-"blockSome": "بلوک ریسک کم"
+"blockSome": "مسدودسازی خطر کم"

This keeps phrasing parallel across the four options.


278-279: Polish the “refreshingModels” text

-"refreshingModels": "طراوت ..."
+"refreshingModels": "در حال تازه‌سازی مدل‌ها..."

A more idiomatic Persian progress message.

src/renderer/src/i18n/ko-KR/settings.json (2)

251-256: Improve the Korean safety-level wording

Current phrasing is awkward (“…을 차단하십시오”). Consider:

-"blockHighest": "높은 위험을 차단하십시오",
-"blockMost": "중간 위험을 차단합니다",
-"blockSome": "낮은 위험을 차단하십시오",
+"blockHighest": "높은 위험 차단",
+"blockMost": "중간 위험 차단",
+"blockSome": "낮은 위험 차단",

Shorter and consistent with common UI patterns.


278-279: More natural progress text

-"refreshingModels": "상쾌한 ..."
+"refreshingModels": "모델 새로고침 중..."
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c216a60 and 37423a7.

📒 Files selected for processing (19)
  • src/main/presenter/configPresenter/modelConfig.ts (7 hunks)
  • src/main/presenter/githubCopilotDeviceFlow.ts (3 hunks)
  • src/main/presenter/llmProviderPresenter/baseProvider.ts (8 hunks)
  • src/main/presenter/llmProviderPresenter/index.ts (1 hunks)
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts (2 hunks)
  • src/renderer/src/components/settings/GeminiSafetyConfig.vue (3 hunks)
  • src/renderer/src/components/settings/ModelProviderSettingsDetail.vue (5 hunks)
  • src/renderer/src/components/settings/ProviderApiConfig.vue (4 hunks)
  • src/renderer/src/i18n/en-US/settings.json (2 hunks)
  • src/renderer/src/i18n/fa-IR/settings.json (2 hunks)
  • src/renderer/src/i18n/fr-FR/settings.json (2 hunks)
  • src/renderer/src/i18n/ja-JP/settings.json (2 hunks)
  • src/renderer/src/i18n/ko-KR/settings.json (2 hunks)
  • src/renderer/src/i18n/ru-RU/settings.json (2 hunks)
  • src/renderer/src/i18n/zh-CN/settings.json (2 hunks)
  • src/renderer/src/i18n/zh-HK/settings.json (2 hunks)
  • src/renderer/src/i18n/zh-TW/settings.json (2 hunks)
  • src/renderer/src/stores/settings.ts (4 hunks)
  • src/shared/presenter.d.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (13)
`**/*.{js,jsx,ts,tsx}`: 使用 OxLint 进行代码检查 Log和注释使用英文书写

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

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

List of files the instruction was applied to:

  • src/shared/presenter.d.ts
  • src/main/presenter/githubCopilotDeviceFlow.ts
  • src/main/presenter/llmProviderPresenter/index.ts
  • src/renderer/src/stores/settings.ts
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • src/main/presenter/configPresenter/modelConfig.ts
`src/shared/*.d.ts`: The shared/*.d.ts files are used to define the types of objects exposed by the main process to the renderer process

src/shared/*.d.ts: The shared/*.d.ts files are used to define the types of objects exposed by the main process to the renderer process

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

List of files the instruction was applied to:

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

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

📄 Source: CodeRabbit Inference Engine (.cursor/rules/error-logging.mdc)

List of files the instruction was applied to:

  • src/shared/presenter.d.ts
  • src/main/presenter/githubCopilotDeviceFlow.ts
  • src/main/presenter/llmProviderPresenter/index.ts
  • src/renderer/src/stores/settings.ts
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • src/main/presenter/configPresenter/modelConfig.ts
`src/shared/**`: 共享类型定义放在 `shared` 目录

src/shared/**: 共享类型定义放在 shared 目录

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

List of files the instruction was applied to:

  • src/shared/presenter.d.ts
`src/main/presenter/**/*.ts`: Use context isolation for improved security Use El...

src/main/presenter/**/*.ts: Use context isolation for improved security
Use Electron's built-in APIs for file system and native dialogs
Optimize application startup time with lazy loading

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

List of files the instruction was applied to:

  • src/main/presenter/githubCopilotDeviceFlow.ts
  • src/main/presenter/llmProviderPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • src/main/presenter/configPresenter/modelConfig.ts
`{src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts}`: Implement proper inter-process communication (IPC) patterns Implement proper error handling and logging for debugging

{src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts}: Implement proper inter-process communication (IPC) patterns
Implement proper error handling and logging for debugging

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

List of files the instruction was applied to:

  • src/main/presenter/githubCopilotDeviceFlow.ts
  • src/main/presenter/llmProviderPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • src/main/presenter/configPresenter/modelConfig.ts
`src/main/**`: 主进程代码放在 `src/main`

src/main/**: 主进程代码放在 src/main

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

List of files the instruction was applied to:

  • src/main/presenter/githubCopilotDeviceFlow.ts
  • src/main/presenter/llmProviderPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • src/main/presenter/configPresenter/modelConfig.ts
`src/renderer/src/**/*`: All user-facing strings in the renderer must use i18n k...

src/renderer/src/**/*: All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Do not hardcode user-facing text in code; always use the translation system (vue-i18n) for all user-visible strings

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

List of files the instruction was applied to:

  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/stores/settings.ts
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/components/settings/GeminiSafetyConfig.vue
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/components/settings/ProviderApiConfig.vue
  • src/renderer/src/components/settings/ModelProviderSettingsDetail.vue
`src/renderer/src/i18n/**/*.json`: Translation key naming must use dot-separated...

src/renderer/src/i18n/**/*.json: Translation key naming must use dot-separated hierarchy, lowercase letters, and meaningful descriptive names (e.g., 'common.button.submit')
Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Keep the structure of translation files consistent across all languages
Regularly check for and remove unused translation keys from translation files

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

List of files the instruction was applied to:

  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
`src/renderer/**`: 渲染进程代码放在 `src/renderer`

src/renderer/**: 渲染进程代码放在 src/renderer

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

List of files the instruction was applied to:

  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/stores/settings.ts
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/components/settings/GeminiSafetyConfig.vue
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/components/settings/ProviderApiConfig.vue
  • src/renderer/src/components/settings/ModelProviderSettingsDetail.vue
`src/main/presenter/llmProviderPresenter/index.ts`: `src/main/presenter/llmProvi...

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 communication with the frontend via eventBus.
The main Agent loop, including the while loop for conversation flow, state management, provider interaction, event handling, and frontend communication, must be implemented in src/main/presenter/llmProviderPresenter/index.ts.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/llm-agent-loop.mdc)

List of files the instruction was applied to:

  • src/main/presenter/llmProviderPresenter/index.ts
`src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}`: Use modules to organize rela...

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

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

List of files the instruction was applied to:

  • src/renderer/src/stores/settings.ts
`src/main/presenter/llmProviderPresenter/providers/*.ts`: Each file in `src/main...

src/main/presenter/llmProviderPresenter/providers/*.ts: Each file in src/main/presenter/llmProviderPresenter/providers/*.ts should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, management of native/non-native tool call mechanisms (prompt wrapping), and standardizing output streams to a common event format.
Provider implementations must use a standardized interface in their coreStream method to yield events, decoupling the main Agent loop from provider-specific details.
The coreStream method in each Provider must perform a single-pass streaming API request per conversation round and must not contain multi-round tool call loop logic.
Provider files must implement the coreStream(messages, modelId, temperature, maxTokens) method, which receives formatted messages and generation parameters, handles tool support (native or via prompt wrapping), makes a single streaming API call, parses provider-specific data, and yields standardized stream events.
Provider files should include provider-specific helper functions such as formatMessages, convertToProviderTools, parseFunctionCalls, and prepareFunctionCallPrompt as needed.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/llm-agent-loop.mdc)

List of files the instruction was applied to:

  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
🧠 Learnings (19)
src/shared/presenter.d.ts (10)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in `src/main/presenter/llmProviderPresenter/providers/*.ts` should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, management of native/non-native tool call mechanisms (prompt wrapping), and standardizing output streams to a common event format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations must use a standardized interface in their `coreStream` method to `yield` events, decoupling the main Agent loop from provider-specific details.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files must implement the `coreStream(messages, modelId, temperature, maxTokens)` method, which receives formatted messages and generation parameters, handles tool support (native or via prompt wrapping), makes a single streaming API call, parses provider-specific data, and yields standardized stream events.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
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 communication with the frontend via `eventBus`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop, including the `while` loop for conversation flow, state management, provider interaction, event handling, and frontend communication, must be implemented in `src/main/presenter/llmProviderPresenter/index.ts`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/streamEvents.ts : Define the standardized stream event interface (`LLMCoreStreamEvent`) in a shared location, such as `src/main/presenter/llmProviderPresenter/streamEvents.ts`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : The `coreStream` method in each Provider must perform a single-pass streaming API request per conversation round and must not contain multi-round tool call loop logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
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
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper inter-process communication (IPC) patterns
src/main/presenter/githubCopilotDeviceFlow.ts (9)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/**/*.ts : Use Electron's built-in APIs for file system and native dialogs
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.335Z
Learning: Use TypeScript for all code, preferring types over interfaces, and avoid enums in favor of const objects.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper error handling and logging for debugging
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/**/*.ts : Use context isolation for improved security
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper inter-process communication (IPC) patterns
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-06-30T12:23:33.814Z
Learning: Applies to **/*.{ts,tsx} : 优雅降级处理
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
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
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/index.ts : The IPC messages from the main process to notify the view mainly rely on the EventBus index.ts to listen for events that need to be notified and then send them to the renderer through the mainWindow
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
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 communication with the frontend via `eventBus`.
src/renderer/src/i18n/fa-IR/settings.json (4)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Keep the structure of translation files consistent across all languages
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Regularly check for and remove unused translation keys from translation files
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
src/renderer/src/i18n/zh-CN/settings.json (7)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Keep the structure of translation files consistent across all languages
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Regularly check for and remove unused translation keys from translation files
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : Do not hardcode user-facing text in code; always use the translation system (vue-i18n) for all user-visible strings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Translation key naming must use dot-separated hierarchy, lowercase letters, and meaningful descriptive names (e.g., 'common.button.submit')
src/main/presenter/llmProviderPresenter/index.ts (8)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in `src/main/presenter/llmProviderPresenter/providers/*.ts` should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, management of native/non-native tool call mechanisms (prompt wrapping), and standardizing output streams to a common event format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
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 communication with the frontend via `eventBus`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files must implement the `coreStream(messages, modelId, temperature, maxTokens)` method, which receives formatted messages and generation parameters, handles tool support (native or via prompt wrapping), makes a single streaming API call, parses provider-specific data, and yields standardized stream events.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop, including the `while` loop for conversation flow, state management, provider interaction, event handling, and frontend communication, must be implemented in `src/main/presenter/llmProviderPresenter/index.ts`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations must use a standardized interface in their `coreStream` method to `yield` events, decoupling the main Agent loop from provider-specific details.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : The `coreStream` method in each Provider must perform a single-pass streaming API request per conversation round and must not contain multi-round tool call loop logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/streamEvents.ts : Define the standardized stream event interface (`LLMCoreStreamEvent`) in a shared location, such as `src/main/presenter/llmProviderPresenter/streamEvents.ts`.
src/renderer/src/i18n/ja-JP/settings.json (6)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Keep the structure of translation files consistent across all languages
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Regularly check for and remove unused translation keys from translation files
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Translation key naming must use dot-separated hierarchy, lowercase letters, and meaningful descriptive names (e.g., 'common.button.submit')
src/renderer/src/i18n/zh-TW/settings.json (6)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Keep the structure of translation files consistent across all languages
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Regularly check for and remove unused translation keys from translation files
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : Do not hardcode user-facing text in code; always use the translation system (vue-i18n) for all user-visible strings
src/renderer/src/stores/settings.ts (10)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Utilize actions for side effects and asynchronous operations
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper error handling and logging for debugging
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations must use a standardized interface in their `coreStream` method to `yield` events, decoupling the main Agent loop from provider-specific details.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper inter-process communication (IPC) patterns
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Keep the store focused on global state, not component-specific data
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files must implement the `coreStream(messages, modelId, temperature, maxTokens)` method, which receives formatted messages and generation parameters, handles tool support (native or via prompt wrapping), makes a single streaming API call, parses provider-specific data, and yields standardized stream events.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use modules to organize related state and actions
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : The `coreStream` method in each Provider must perform a single-pass streaming API request per conversation round and must not contain multi-round tool call loop logic.
src/renderer/src/i18n/en-US/settings.json (7)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Keep the structure of translation files consistent across all languages
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Regularly check for and remove unused translation keys from translation files
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : Do not hardcode user-facing text in code; always use the translation system (vue-i18n) for all user-visible strings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Translation key naming must use dot-separated hierarchy, lowercase letters, and meaningful descriptive names (e.g., 'common.button.submit')
src/renderer/src/i18n/ru-RU/settings.json (5)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Keep the structure of translation files consistent across all languages
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Translation key naming must use dot-separated hierarchy, lowercase letters, and meaningful descriptive names (e.g., 'common.button.submit')
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
src/renderer/src/i18n/ko-KR/settings.json (4)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Keep the structure of translation files consistent across all languages
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
src/renderer/src/i18n/zh-HK/settings.json (5)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Keep the structure of translation files consistent across all languages
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Regularly check for and remove unused translation keys from translation files
src/renderer/src/components/settings/GeminiSafetyConfig.vue (15)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use getters for computed state properties
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : Do not hardcode user-facing text in code; always use the translation system (vue-i18n) for all user-visible strings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-06-23T13:06:02.806Z
Learning: Leverage Vue's built-in reactivity system for efficient data handling in Vue.js applications.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.336Z
Learning: Use <script setup> syntax for concise Vue 3 component definitions.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.335Z
Learning: Use template syntax for declarative rendering in Vue components.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-06-23T13:06:02.806Z
Learning: In Vue.js applications, prefer the Composition API for better code organization and reusability.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.336Z
Learning: Leverage ref, reactive, and computed for reactive state management in the Composition API.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.336Z
Learning: Implement custom composables for reusable logic in Vue 3/Nuxt 3 projects.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.335Z
Learning: Leverage defineComponent and PropType for strong typing in Vue 3 components.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.335Z
Learning: Use VueUse for common composables and utility functions to promote code reuse.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.335Z
Learning: Use Shadcn Vue, Radix Vue, and Tailwind for UI components and styling.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.335Z
Learning: Utilize Nuxt's auto-imports feature for components and composables to reduce boilerplate.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-06-30T12:23:33.814Z
Learning: Applies to **/*.{ts,tsx} : 设置适当的日志级别
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/error-logging.mdc:0-0
Timestamp: 2025-06-30T12:23:33.814Z
Learning: Applies to **/*.{ts,tsx} : 避免记录敏感信息
src/renderer/src/i18n/fr-FR/settings.json (6)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Keep the structure of translation files consistent across all languages
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : When adding a new translation, add shared translations to common.json and language-specific translations to the respective language file; keep all language files' keys consistent
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings in the renderer must use i18n keys (do not hardcode user-visible text in code; use vue-i18n translation keys instead)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : Do not hardcode user-facing text in code; always use the translation system (vue-i18n) for all user-visible strings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Each language must have a separate JSON file in src/renderer/src/i18n/, and shared translation keys must be placed in common.json
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Regularly check for and remove unused translation keys from translation files
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts (13)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
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 communication with the frontend via `eventBus`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations must use a standardized interface in their `coreStream` method to `yield` events, decoupling the main Agent loop from provider-specific details.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/streamEvents.ts : Define the standardized stream event interface (`LLMCoreStreamEvent`) in a shared location, such as `src/main/presenter/llmProviderPresenter/streamEvents.ts`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/eventbus.ts : eventbus.ts is primarily used for intercommunication between main processes and decouples modules with events
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in `src/main/presenter/llmProviderPresenter/providers/*.ts` should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, management of native/non-native tool call mechanisms (prompt wrapping), and standardizing output streams to a common event format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/index.ts : The IPC messages from the main process to notify the view mainly rely on the EventBus index.ts to listen for events that need to be notified and then send them to the renderer through the mainWindow
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files must implement the `coreStream(messages, modelId, temperature, maxTokens)` method, which receives formatted messages and generation parameters, handles tool support (native or via prompt wrapping), makes a single streaming API call, parses provider-specific data, and yields standardized stream events.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop, including the `while` loop for conversation flow, state management, provider interaction, event handling, and frontend communication, must be implemented in `src/main/presenter/llmProviderPresenter/index.ts`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Maintain separation of concerns by centralizing Agent loop logic in `index.ts` and keeping provider files focused on API interaction and event standardization.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
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
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper error handling and logging for debugging
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper inter-process communication (IPC) patterns
src/renderer/src/components/settings/ProviderApiConfig.vue (8)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files must implement the `coreStream(messages, modelId, temperature, maxTokens)` method, which receives formatted messages and generation parameters, handles tool support (native or via prompt wrapping), makes a single streaming API call, parses provider-specific data, and yields standardized stream events.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-06-30T12:23:45.479Z
Learning: Applies to src/renderer/src/**/* : Do not hardcode user-facing text in code; always use the translation system (vue-i18n) for all user-visible strings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.336Z
Learning: Leverage ref, reactive, and computed for reactive state management in the Composition API.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop, including the `while` loop for conversation flow, state management, provider interaction, event handling, and frontend communication, must be implemented in `src/main/presenter/llmProviderPresenter/index.ts`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
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 communication with the frontend via `eventBus`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in `src/main/presenter/llmProviderPresenter/providers/*.ts` should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, management of native/non-native tool call mechanisms (prompt wrapping), and standardizing output streams to a common event format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : The `coreStream` method in each Provider must perform a single-pass streaming API request per conversation round and must not contain multi-round tool call loop logic.
src/renderer/src/components/settings/ModelProviderSettingsDetail.vue (6)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use getters for computed state properties
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/**/*.ts : Use context isolation for improved security
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/**/*.ts : Use Electron's built-in APIs for file system and native dialogs
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.336Z
Learning: Use provide/inject for dependency injection when appropriate in Vue 3.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
src/main/presenter/llmProviderPresenter/baseProvider.ts (11)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in `src/main/presenter/llmProviderPresenter/providers/*.ts` should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, management of native/non-native tool call mechanisms (prompt wrapping), and standardizing output streams to a common event format.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should include provider-specific helper functions such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files must implement the `coreStream(messages, modelId, temperature, maxTokens)` method, which receives formatted messages and generation parameters, handles tool support (native or via prompt wrapping), makes a single streaming API call, parses provider-specific data, and yields standardized stream events.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations must use a standardized interface in their `coreStream` method to `yield` events, decoupling the main Agent loop from provider-specific details.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
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 communication with the frontend via `eventBus`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/streamEvents.ts : Define the standardized stream event interface (`LLMCoreStreamEvent`) in a shared location, such as `src/main/presenter/llmProviderPresenter/streamEvents.ts`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : The `coreStream` method in each Provider must perform a single-pass streaming API request per conversation round and must not contain multi-round tool call loop logic.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-06-30T12:24:03.565Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : The main Agent loop, including the `while` loop for conversation flow, state management, provider interaction, event handling, and frontend communication, must be implemented in `src/main/presenter/llmProviderPresenter/index.ts`.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/**/*.ts : Optimize application startup time with lazy loading
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
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
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper error handling and logging for debugging
src/main/presenter/configPresenter/modelConfig.ts (5)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/**/*.ts : Optimize application startup time with lazy loading
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to src/main/presenter/**/*.ts : Use context isolation for improved security
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:23:13.338Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts} : Implement proper error handling and logging for debugging
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-06-30T12:24:10.749Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Keep the store focused on global state, not component-specific data
🧬 Code Graph Analysis (1)
src/main/presenter/configPresenter/modelConfig.ts (1)
src/shared/presenter.d.ts (2)
  • IModelConfig (129-133)
  • ModelConfig (120-128)
🪛 Biome (1.9.4)
src/renderer/src/i18n/zh-CN/settings.json

[error] 254-254: The key refreshModels was already declared.

This where a duplicated key was declared again.

If a key is defined multiple times, only the last definition takes effect. Previous definitions are ignored.

(lint/suspicious/noDuplicateObjectKeys)

⏰ 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)
🔇 Additional comments (33)
src/main/presenter/githubCopilotDeviceFlow.ts (1)

2-2: LGTM: Consistent semicolon style applied.

The removal of trailing semicolons across import statements, constant declarations, console logging, and JavaScript code strings maintains consistent code style throughout the file.

Also applies to: 5-5, 305-306, 312-312, 316-316, 327-327, 329-329, 331-331, 334-334, 337-337, 340-340

src/shared/presenter.d.ts (1)

517-517: LGTM: Well-defined interface method addition.

The new refreshModels method follows the established pattern in the interface with appropriate parameter typing and return type. The method signature is clear and consistent with other provider-related methods.

src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts (2)

27-28: LGTM: Proper imports for event bus integration

The imports are correctly structured and align with the established event bus pattern for inter-process communication in the application.


300-305: LGTM: Appropriate workaround for Gemini's slow initialization

The event dispatch after model initialization is a well-placed compensation for Gemini's slower loading speed. This ensures the UI is promptly updated with the model list changes, addressing the core issue mentioned in the PR objectives.

src/renderer/src/i18n/en-US/settings.json (2)

250-256: LGTM: Clear and well-structured safety level translations

The safety level options are clearly translated with appropriate risk level descriptions. The translations follow proper English conventions and will provide users with clear understanding of the different blocking levels.


277-278: LGTM: Appropriate status message for model refresh

The "refreshingModels" key is properly placed under the keyStatus section and uses appropriate present continuous tense for status feedback during model refresh operations.

src/renderer/src/i18n/zh-TW/settings.json (2)

250-256: LGTM: Consistent and appropriate Traditional Chinese translations

The safety level translations maintain consistent terminology using "屏蔽" (block) and provide clear risk level descriptions that align with the English version structure.


277-278: LGTM: Proper status message localization

The "refreshingModels" translation "刷新中..." follows proper Chinese conventions for ongoing status messages and maintains consistency with the key structure.

src/renderer/src/i18n/ja-JP/settings.json (1)

250-256: LGTM: Appropriate Japanese safety level translations

The safety level translations use consistent "ブロック" (block) terminology and provide clear risk level descriptions that align with the other language versions.

src/renderer/src/i18n/ru-RU/settings.json (2)

250-256: Safety-level strings look good
Keys and placement are consistent with the surrounding locale structure.


277-279: refreshingModels key correctly introduced

No duplicates detected in this locale and the value matches the style of the file.

src/renderer/src/i18n/zh-HK/settings.json (2)

251-256: Safety strings added – no issues found
Translation and key names align with the other locales.


278-279: refreshingModels key correctly placed
No duplicates in this file.

src/renderer/src/stores/settings.ts (1)

535-542: Internal error handling confirmed for fire-and-forget calls

Both refreshCustomModels and refreshStandardModels wrap their entire implementations in try–catch blocks and log errors internally, preventing unhandled promise rejections when invoked without await. The parallel execution is intentional to avoid blocking the UI.

No further changes are required, though you may add a brief comment to document this intentional fire-and-forget behavior.

src/renderer/src/i18n/fr-FR/settings.json (1)

251-255: LGTM! Well-structured localization additions.

The new localization keys are properly structured and follow the established naming conventions:

  • Safety level keys are correctly nested under provider.safety
  • The refreshingModels key is appropriately placed under provider.keyStatus
  • French translations appear accurate and consistent with the codebase style

These additions align well with the enhanced safety configuration and model refresh features mentioned in the AI summary.

Also applies to: 277-278

src/renderer/src/components/settings/GeminiSafetyConfig.vue (2)

73-86: Excellent defensive programming with accessor functions.

The new accessor functions provide safe fallbacks for undefined values, preventing potential runtime errors. The functions properly handle edge cases:

  • getSafetyLevel: Returns default level when data is missing
  • getLevelLabel and getLevelValue: Provide fallback to index 0 when level is undefined

This is a solid improvement in error prevention and code robustness.


89-112: Improved reactivity handling with proper cleanup.

The enhanced watch logic with deep watching and key clearing is a good practice:

  • Clearing existing keys prevents stale data from persisting
  • Deep watching ensures nested changes are properly detected
  • The immediate flag ensures proper initialization

This should resolve potential reactivity issues when safety levels are updated.

src/renderer/src/components/settings/ProviderApiConfig.vue (2)

70-82: Well-implemented model refresh UI with proper loading states.

The new "Refresh Models" button provides excellent user experience:

  • Loading state with spinner animation during refresh
  • Button disabled to prevent multiple simultaneous operations
  • Clear visual feedback with text changes during operation
  • Conditional rendering excludes custom providers appropriately

The UI implementation follows best practices for async operations.


202-213: Solid async function implementation with proper error handling.

The refreshModels function is well-structured:

  • Guard clause prevents multiple simultaneous refresh operations
  • Proper try-catch-finally pattern ensures cleanup
  • Error logging provides debugging information
  • State management with isRefreshing controls UI feedback

This follows Vue.js and TypeScript best practices for async operations.

src/renderer/src/components/settings/ModelProviderSettingsDetail.vue (4)

78-78: Good practice: Centralized type imports.

Importing types from @/lib/gemini instead of defining them locally improves maintainability and reduces duplication. This ensures consistent type definitions across components.


199-202: Excellent defensive programming: Clearing stale data.

Clearing existing keys before reinitialization prevents stale data from persisting between provider switches. This is a good practice for reactive data management.


212-218: Improved type safety with explicit assertions.

The type assertions ensure type safety when dealing with configuration values that might be unknown. This prevents runtime type errors and improves code reliability.


356-360: Smart reactivity solution with computed property.

Using a computed property to create a shallow copy ensures reactivity is properly maintained when passing data to child components. This is a good Vue.js pattern for reactive data flow.

src/main/presenter/llmProviderPresenter/baseProvider.ts (5)

14-15: Imports added correctly for event broadcasting.

The addition of eventBus and CONFIG_EVENTS imports aligns with the implementation of model refresh functionality and proper IPC patterns.


49-51: Excellent implementation of cached model loading.

The loadCachedModels() method properly implements lazy loading as per the coding guidelines, with robust error handling and appropriate logging. This optimization will significantly improve application startup time by avoiding unnecessary network calls.

Also applies to: 61-90


118-119: Good optimization using cached custom models.

Using the cached this.customModels instead of fetching from config prevents redundant retrieval and improves performance.


162-176: Well-implemented model refresh functionality.

The refreshModels() method properly implements the force refresh capability with appropriate event broadcasting via IPC. This directly addresses the PR objective of improving Gemini loading performance.


215-216: Proper synchronization between cache and persistent storage.

The immediate synchronization with ConfigPresenter after modifying the in-memory customModels array ensures data consistency. This is a crucial improvement for maintaining state across sessions.

Also applies to: 229-230, 247-248

src/main/presenter/configPresenter/modelConfig.ts (5)

11-12: Well-designed memory cache with lazy initialization.

The cache implementation follows best practices with:

  • Lazy initialization pattern to optimize startup time
  • Batch loading of all configs for efficiency
  • Proper initialization flag to prevent redundant loads

This aligns perfectly with the coding guideline to "optimize application startup time with lazy loading".

Also applies to: 20-33


41-56: Efficient cache-first approach with proper fallback.

The implementation correctly:

  • Ensures cache is initialized before use
  • Attempts cache lookup first for performance
  • Falls back to store and updates cache on miss
  • Preserves the original config priority logic

This provides performance benefits while maintaining correctness.


105-114: Excellent cache-store synchronization in write operations.

All write operations properly maintain consistency by updating both layers:

  • setModelConfig: Updates both store and cache atomically
  • resetModelConfig: Removes from both layers
  • importConfigs: Handles overwrite scenario correctly by clearing both
  • clearAllConfigs: Clears both storage layers

This ensures data integrity across all operations.

Also applies to: 123-127, 202-215, 231-231


135-143: Optimized read operations with consistent caching pattern.

Both methods follow the established pattern:

  • getAllModelConfigs: Efficiently returns data from cache
  • hasUserConfig: Cache-first lookup with store fallback and cache update

The consistent approach across all read operations improves performance while maintaining correctness.

Also applies to: 175-193


241-248: Useful utility method for cache management.

The clearMemoryCache() method provides a clean way to reset cache state, which is valuable for testing and memory management scenarios. Properly resets both the cache map and initialization flag.

@ThinkInAIXYZ ThinkInAIXYZ deleted a comment from coderabbitai bot Jul 9, 2025
@zerob13 zerob13 merged commit f22a653 into dev Jul 9, 2025
2 checks passed
@zerob13 zerob13 deleted the refactor/optimized-get-model-config branch September 21, 2025 15:15
@coderabbitai coderabbitai bot mentioned this pull request Dec 1, 2025
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