Skip to content

Conversation

@hllshiro
Copy link
Collaborator

@hllshiro hllshiro commented Jul 14, 2025

Pull Request Description (中文)

你的功能请求是否与某个问题有关?请描述一下。
请对问题进行清晰扼要的描述。

  • 增加了内置知识库实现,允许用户在本地创建、管理和检索知识,为 DeepChat 带来了离线环境下的 RAG (Retrieval-Augmented Generation) 能力。
  • 优化了部分ollama相关的逻辑。
  • 将FilePresenter的getContent设置为public,用于文本原始内容提取。
  • 修改了大量i18n相关内容。

桌面应用程序的 UI/UX 更改
如果此 PR 引入了 UI/UX 更改,请详细描述它们。
image
image
image
image

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

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

新增依赖

  • @duckdb/node-api: 用于本地向量数据库。
  • @langchain/core & @langchain/textsplitters: 用于文本处理和分块。
  • dayjs: 用于日期时间格式化。
  • scripts/postinstall.js: 增加了 duckdb 扩展的安装脚本,在安装依赖时将 vss 扩展拷贝到 runtime 目录下,构建时作为额外资源打包,避免运行时重复下载。

已知问题

  • “重排序模型“ 目前未实现相关逻辑,选项暂时隐藏
  • 文本切分方式只有一种,后续会扩展
  • 上传文件后,文档处理过程中关闭应用,重启后无法恢复任务,后续会优化
  • 目前的相似度算法可能不适用于所有向量模型,导致出现远大于1的相似度值,后续会优化

Summary by CodeRabbit

  • New Features

    • Introduced a built-in knowledge base system for local storage, retrieval, and management of knowledge files.
    • Added a user interface for configuring, uploading, searching, and managing built-in knowledge bases and files.
    • Enabled similarity search within uploaded knowledge files using local embedding models and a DuckDB vector database.
    • Provided auto-detection of embedding dimensions and normalization options.
    • Integrated support for multiple languages in the user interface and settings.
    • Added an in-memory server to expose built-in knowledge base search tools.
  • Enhancements

    • Added advanced configuration options for chunk size, overlap, and fragment numbers in knowledge base settings.
    • Improved file status tracking with real-time updates and error handling during upload and processing.
    • Centralized MIME type icon mapping for consistent file display.
    • Enhanced model listing with detailed metadata and capability flags.
    • Improved filtering logic in model selection to exclude providers without models when no search keyword is entered.
  • Bug Fixes

    • Corrected filtering logic in model selection and improved error handling for file operations.
  • Documentation

    • Added comprehensive documentation detailing the built-in knowledge base architecture, design, workflows, and extension guidelines.
  • Localization

    • Extended localization support for built-in knowledge base features across multiple languages.

hllshiro and others added 30 commits June 18, 2025 15:46
…hance BuiltinKnowledgeSettings with URL query parameter handling
…rs and loading logic for better user experience
… model listing with additional configuration properties
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 14, 2025

Walkthrough

This update introduces a comprehensive built-in knowledge base system with local storage, retrieval, and management features. It adds new architecture and design documents, presenter classes for knowledge and vector database management, embedding support, file chunking and ingestion workflows, event-driven synchronization, and a full-featured UI for configuring, uploading, and querying knowledge files. Extensive localization, utility functions, and dependency updates support the new functionality.

Changes

File(s) / Group Change Summary
docs/builtin-knowledge.md, docs/builtin-knowledge-architecture.md, docs/builtin-knowledge-design.md Added detailed architecture, design, and functional documentation for the BuiltinKnowledge module.
src/main/presenter/knowledgePresenter/... (index.ts, knowledgeStorePresenter.ts, database/duckdbPresenter.ts) Introduced KnowledgePresenter, KnowledgeStorePresenter, and DuckDBPresenter for knowledge base management and vector DB.
src/main/presenter/configPresenter/... (index.ts, knowledgeConfHelper.ts, mcpConfHelper.ts, modelDefaultSettings.ts) Added helpers and methods for knowledge base config management, default settings, and new embedding model support.
src/main/presenter/llmProviderPresenter/... (index.ts, baseProvider.ts, providers/ollamaProvider.ts, providers/openAICompatibleProvider.ts) Enhanced embedding and dimension support, added getDimensions, improved Ollama/OpenAI provider model metadata.
src/main/presenter/filePresenter/BaseFileAdapter.ts, FilePresenter.ts Extended file preparation methods for content-type flexibility and public access.
src/main/presenter/index.ts, src/shared/presenter.d.ts Integrated KnowledgePresenter into main presenter and type declarations.
src/main/presenter/mcpPresenter/inMemoryServers/builder.ts, builtinKnowledgeServer.ts Added BuiltinKnowledgeServer for in-memory knowledge base search tool exposure.
src/main/events.ts, src/renderer/src/events.ts Added RAG_EVENTS for file status update eventing.
src/main/utils/strings.ts, src/main/utils/vector.ts Introduced text sanitization and vector normalization utilities.
src/renderer/src/components/settings/... (BuiltinKnowledgeSettings.vue, KnowledgeBaseSettings.vue, KnowledgeFile.vue, KnowledgeFileItem.vue, ModelConfigItem.vue) Added/updated UI components for built-in knowledge base configuration, file management, and detail viewing.
src/renderer/src/components/FileItem.vue, src/renderer/src/lib/utils.ts Centralized MIME type to icon mapping utility and refactored FileItem icon logic.
src/renderer/src/components/ModelSelect.vue, McpServers.vue, settings/DifyKnowledgeSettings.vue, ... Enhanced filtering, navigation, and dialog descriptions for knowledge base and provider settings.
src/renderer/src/stores/settings.ts Improved Ollama model capability and context/embedding length handling.
src/renderer/src/i18n/*/mcp.json, settings.json Extended localization for built-in knowledge base features and UI across all supported languages.
package.json, scripts/postinstall.js Added DuckDB, LangChain, dayjs dependencies; automated DuckDB VSS extension install.

Sequence Diagram(s)

Knowledge Base File Ingestion and Similarity Query (Simplified)

sequenceDiagram
    participant User
    participant UI
    participant KnowledgePresenter
    participant KnowledgeStorePresenter
    participant VectorDatabase (DuckDBPresenter)
    participant LLMProvider

    User->>UI: Upload file / Search query
    UI->>KnowledgePresenter: addFile(id, filePath) / similarityQuery(id, key)
    KnowledgePresenter->>KnowledgeStorePresenter: addFile(filePath) / similarityQuery(key)
    KnowledgeStorePresenter->>LLMProvider: getEmbeddings(chunks/query)
    LLMProvider-->>KnowledgeStorePresenter: embeddings
    KnowledgeStorePresenter->>VectorDatabase: insertVectors / similarityQuery
    VectorDatabase-->>KnowledgeStorePresenter: insert result / query result
    KnowledgeStorePresenter-->>KnowledgePresenter: file status / query result
    KnowledgePresenter-->>UI: status update / search results
    UI-->>User: Show file status / search results
Loading

Configuration Change and Knowledge Base Synchronization

sequenceDiagram
    participant ConfigPresenter
    participant KnowledgePresenter
    participant KnowledgeStorePresenter

    ConfigPresenter->>KnowledgePresenter: emit config change event
    KnowledgePresenter->>KnowledgePresenter: diff old/new configs
    alt Added config
        KnowledgePresenter->>KnowledgeStorePresenter: create new knowledge store
    end
    alt Deleted config
        KnowledgePresenter->>KnowledgeStorePresenter: destroy knowledge store
    end
    KnowledgePresenter-->>ConfigPresenter: sync complete
Loading

Suggested reviewers

  • deepinfect

Poem

🐇
In burrows deep, the knowledge grows,
With vectors, chunks, and files it flows.
DuckDB hums, embeddings gleam,
Search and sync—a rabbit’s dream!
Now wisdom hops from UI to core,
With every byte, we learn some more.
Hooray for knowledge, let’s explore!


📜 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 fac2eb4 and 25ef9cb.

📒 Files selected for processing (1)
  • src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts
✨ 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.

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: 24

🔭 Outside diff range comments (1)
src/shared/presenter.d.ts (1)

896-896: Fix typo in Record type definition.

There's a typo in the type definition.

Apply this diff to fix the typo:

-  env: Record<string, unknow>
+  env: Record<string, unknown>
🧹 Nitpick comments (14)
src/renderer/src/lib/utils.ts (3)

4-8: Convert Chinese comments to English.

According to the coding guidelines, logs and comments should be written in English.

Apply this diff to convert the function documentation:

-/**
- * 合并 Tailwind CSS 类名
- * @param inputs
- * @returns
- */
+/**
+ * Merge Tailwind CSS class names
+ * @param inputs
+ * @returns
+ */

13-17: Convert Chinese comments to English.

The function documentation should be in English according to the coding guidelines.

Apply this diff to convert the function documentation:

-/**
- * 根据 MIME 类型获取文件图标
- * @param mimeType
- * @returns
- */
+/**
+ * Get file icon based on MIME type
+ * @param mimeType
+ * @returns
+ */

63-64: Convert Chinese comment to English.

The inline comment should be in English according to the coding guidelines.

Apply this diff:

-    // 默认文件图标
+    // Default file icon
src/main/events.ts (1)

177-179: Event definition follows naming convention correctly.

The new RAG_EVENTS category and FILE_UPDATED event properly follow the established naming convention with colon-separated domain and lowercase with hyphens.

However, convert the Chinese comment to English:

-  FILE_UPDATED: 'rag:file-updated' // 文件状态更新
+  FILE_UPDATED: 'rag:file-updated' // File status update
src/main/utils/strings.ts (1)

1-9: Add function documentation and consider performance optimization.

The sanitization logic is appropriate for cleaning text before embedding generation. However, the function could benefit from JSDoc documentation and performance optimization.

Apply this diff to add documentation and optimize performance:

+/**
+ * Sanitizes text for embedding generation by removing problematic characters
+ * and normalizing whitespace.
+ * @param text - The input text to sanitize
+ * @returns The sanitized text with normalized whitespace
+ */
export function sanitizeText(text: string) {
-  text = text.replace(/\\/g, '')
-  text = text.replace(/#/g, ' ')
-  text = text.replace(/\. \./g, '.')
-  text = text.replace(/\s\s+/g, ' ')
-  text = text.replace(/(\r\n|\n|\r)/gm, ' ')
-
-  return text.trim()
+  return text
+    .replace(/\\/g, '')
+    .replace(/#/g, ' ')
+    .replace(/\. \./g, '.')
+    .replace(/\s\s+/g, ' ')
+    .replace(/(\r\n|\n|\r)/gm, ' ')
+    .trim()
}

This approach chains the operations and avoids multiple variable reassignments, making it more functional and potentially more performant.

src/renderer/src/components/settings/KnowledgeFileItem.vue (1)

108-114: Replace Chinese comment and consider extracting utility function.

The comment should be in English, and the file size formatting function could be extracted to a shared utility.

Apply this diff to fix the comment:

-// 文件大小的单位转换
+// File size unit conversion
 const formatFileSize = (bytes: number): string => {

Consider extracting this function to src/renderer/src/lib/utils.ts for reusability across components.

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

618-625: Consider adding JSDoc documentation for the new method.

The getDimensions method would benefit from more detailed documentation about its purpose and return value structure.

Apply this diff to improve documentation:

  /**
   * 获取嵌入向量的维度
   * @param _modelId 模型ID
-  * @returns 嵌入向量的维度
+  * @returns 嵌入向量的维度和相关属性,包括dimensions(维度大小)和normalized(是否归一化)
   */
src/main/presenter/configPresenter/knowledgeConfHelper.ts (1)

32-50: Improve the configuration diff method for better reliability.

The current implementation uses JSON.stringify for comparison, which can be fragile due to property ordering. Consider using a more robust comparison method.

  static diffKnowledgeConfigs(
    oldConfigs: BuiltinKnowledgeConfig[],
    newConfigs: BuiltinKnowledgeConfig[]
  ): {
    added: BuiltinKnowledgeConfig[]
    deleted: BuiltinKnowledgeConfig[]
    updated: BuiltinKnowledgeConfig[]
  } {
    const oldMap = new Map(oldConfigs.map((cfg) => [cfg.id, cfg]))
    const newMap = new Map(newConfigs.map((cfg) => [cfg.id, cfg]))

    const added = newConfigs.filter((cfg) => !oldMap.has(cfg.id))
    const deleted = oldConfigs.filter((cfg) => !newMap.has(cfg.id))
    const updated = newConfigs.filter(
-      (cfg) => oldMap.has(cfg.id) && JSON.stringify(cfg) !== JSON.stringify(oldMap.get(cfg.id))
+      (cfg) => {
+        const oldCfg = oldMap.get(cfg.id)
+        if (!oldCfg) return false
+        
+        // Compare specific fields instead of JSON.stringify
+        return cfg.description !== oldCfg.description ||
+               cfg.enabled !== oldCfg.enabled ||
+               cfg.dimensions !== oldCfg.dimensions ||
+               cfg.normalized !== oldCfg.normalized ||
+               cfg.chunkSize !== oldCfg.chunkSize ||
+               cfg.chunkOverlap !== oldCfg.chunkOverlap ||
+               cfg.fragmentsNumber !== oldCfg.fragmentsNumber ||
+               JSON.stringify(cfg.embedding) !== JSON.stringify(oldCfg.embedding) ||
+               JSON.stringify(cfg.rerank) !== JSON.stringify(oldCfg.rerank)
+      }
    )

    return { added, deleted, updated }
  }
src/main/presenter/filePresenter/FilePresenter.ts (1)

95-101: Improve parameter typing for contentType.

The contentType parameter uses a union type that includes both null and 'null' which could be confusing. Consider using a more explicit type.

- async prepareFileCompletely(absPath: string, typeInfo?: string, contentType?: null | 'null' | 'origin' | 'llm-friendly'): Promise<MessageFile> {
+ async prepareFileCompletely(absPath: string, typeInfo?: string, contentType?: 'origin' | 'llm-friendly' | null): Promise<MessageFile> {
src/renderer/src/components/settings/KnowledgeFile.vue (1)

221-231: Consider improving error handling in search.

The search method uses any type for the response and doesn't handle potential errors from the similarityQuery call.

Apply this diff to improve error handling:

 const handleSearch = async () => {
   if (!searchKey.value) return
   copyId.value = ''
   loading.value = true
-  knowledgePresenter
-    .similarityQuery(props.builtinKnowledgeDetail.id, searchKey.value)
-    .then((res: any) => {
-      searchResult.value = res || []
-      loading.value = false
-    })
+  try {
+    const res = await knowledgePresenter.similarityQuery(
+      props.builtinKnowledgeDetail.id,
+      searchKey.value
+    )
+    searchResult.value = res || []
+  } catch (error) {
+    console.error('Search failed:', error)
+    toast({
+      title: t('settings.knowledgeBase.searchError'),
+      variant: 'destructive',
+      duration: 3000
+    })
+    searchResult.value = []
+  } finally {
+    loading.value = false
+  }
 }
src/renderer/src/components/settings/OllamaProviderSettingsDetail.vue (1)

409-413: Consider using proper default values for model metadata.

The model_info object uses NaN values which might cause issues in downstream processing.

Apply this diff to use more appropriate default values:

 model_info: {
-  context_length: NaN,
-  embedding_length: NaN
+  context_length: 0,
+  embedding_length: 0
 },

Using 0 or undefined would be more appropriate than NaN for numeric fields that represent unknown values.

src/main/presenter/llmProviderPresenter/providers/ollamaProvider.ts (1)

292-309: Temporary model info enrichment implementation

The FIXME comments indicate this is a temporary workaround until the Ollama list API is enhanced. The string concatenation approach for accessing model info properties (e.g., family + '.context_length') is fragile and should be improved when the API is updated.

Would you like me to create an issue to track the API enhancement and subsequent refactoring of this code?

Also applies to: 316-317, 328-329

docs/builtin-knowledge-architecture.md (1)

1-110: Consider translating documentation to English

According to the coding guidelines, logs and comments should be written in English. While this is documentation rather than code comments, having technical documentation in English would improve international collaboration and maintain consistency with the codebase.

Would you like me to help translate this architecture documentation to English?

src/main/presenter/knowledgePresenter/index.ts (1)

59-60: Use optional chaining for cleaner code

The condition can be simplified using optional chaining.

-        if (builtinConfig && builtinConfig.env && Array.isArray(builtinConfig.env.configs)) {
+        if (builtinConfig?.env?.configs && Array.isArray(builtinConfig.env.configs)) {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6bf2cf7 and 564a985.

📒 Files selected for processing (68)
  • docs/builtin-knowledge-architecture.md (1 hunks)
  • docs/builtin-knowledge-design.md (1 hunks)
  • docs/builtin-knowledge.md (1 hunks)
  • package.json (1 hunks)
  • scripts/postinstall.js (1 hunks)
  • src/main/events.ts (1 hunks)
  • src/main/index.ts (1 hunks)
  • src/main/presenter/configPresenter/index.ts (5 hunks)
  • src/main/presenter/configPresenter/knowledgeConfHelper.ts (1 hunks)
  • src/main/presenter/configPresenter/mcpConfHelper.ts (1 hunks)
  • src/main/presenter/configPresenter/modelDefaultSettings.ts (1 hunks)
  • src/main/presenter/filePresenter/BaseFileAdapter.ts (1 hunks)
  • src/main/presenter/filePresenter/FilePresenter.ts (2 hunks)
  • src/main/presenter/index.ts (3 hunks)
  • src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts (1 hunks)
  • src/main/presenter/knowledgePresenter/index.ts (1 hunks)
  • src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (1 hunks)
  • src/main/presenter/llmProviderPresenter/baseProvider.ts (2 hunks)
  • src/main/presenter/llmProviderPresenter/index.ts (2 hunks)
  • src/main/presenter/llmProviderPresenter/providers/ollamaProvider.ts (4 hunks)
  • src/main/presenter/llmProviderPresenter/providers/openAICompatibleProvider.ts (2 hunks)
  • src/main/presenter/mcpPresenter/inMemoryServers/builder.ts (2 hunks)
  • src/main/presenter/mcpPresenter/inMemoryServers/builtinKnowledgeServer.ts (1 hunks)
  • src/main/utils/strings.ts (1 hunks)
  • src/main/utils/vector.ts (1 hunks)
  • src/renderer/src/components/FileItem.vue (2 hunks)
  • src/renderer/src/components/ModelSelect.vue (1 hunks)
  • src/renderer/src/components/mcp-config/components/McpServers.vue (1 hunks)
  • src/renderer/src/components/settings/BuiltinKnowledgeSettings.vue (1 hunks)
  • src/renderer/src/components/settings/DifyKnowledgeSettings.vue (2 hunks)
  • src/renderer/src/components/settings/FastGptKnowledgeSettings.vue (2 hunks)
  • src/renderer/src/components/settings/KnowledgeBaseSettings.vue (8 hunks)
  • src/renderer/src/components/settings/KnowledgeFile.vue (1 hunks)
  • src/renderer/src/components/settings/KnowledgeFileItem.vue (1 hunks)
  • src/renderer/src/components/settings/ModelConfigItem.vue (2 hunks)
  • src/renderer/src/components/settings/OllamaProviderSettingsDetail.vue (5 hunks)
  • src/renderer/src/components/settings/RagflowKnowledgeSettings.vue (2 hunks)
  • src/renderer/src/events.ts (1 hunks)
  • src/renderer/src/i18n/en-US/about.json (1 hunks)
  • src/renderer/src/i18n/en-US/mcp.json (1 hunks)
  • src/renderer/src/i18n/en-US/settings.json (2 hunks)
  • src/renderer/src/i18n/fa-IR/about.json (1 hunks)
  • src/renderer/src/i18n/fa-IR/mcp.json (1 hunks)
  • src/renderer/src/i18n/fa-IR/settings.json (2 hunks)
  • src/renderer/src/i18n/fr-FR/about.json (1 hunks)
  • src/renderer/src/i18n/fr-FR/mcp.json (1 hunks)
  • src/renderer/src/i18n/fr-FR/settings.json (2 hunks)
  • src/renderer/src/i18n/ja-JP/about.json (1 hunks)
  • src/renderer/src/i18n/ja-JP/mcp.json (1 hunks)
  • src/renderer/src/i18n/ja-JP/settings.json (2 hunks)
  • src/renderer/src/i18n/ko-KR/about.json (1 hunks)
  • src/renderer/src/i18n/ko-KR/mcp.json (1 hunks)
  • src/renderer/src/i18n/ko-KR/settings.json (2 hunks)
  • src/renderer/src/i18n/ru-RU/about.json (1 hunks)
  • src/renderer/src/i18n/ru-RU/mcp.json (1 hunks)
  • src/renderer/src/i18n/ru-RU/settings.json (2 hunks)
  • src/renderer/src/i18n/zh-CN/about.json (1 hunks)
  • src/renderer/src/i18n/zh-CN/mcp.json (1 hunks)
  • src/renderer/src/i18n/zh-CN/settings.json (3 hunks)
  • src/renderer/src/i18n/zh-HK/about.json (1 hunks)
  • src/renderer/src/i18n/zh-HK/mcp.json (1 hunks)
  • src/renderer/src/i18n/zh-HK/settings.json (2 hunks)
  • src/renderer/src/i18n/zh-TW/about.json (1 hunks)
  • src/renderer/src/i18n/zh-TW/mcp.json (1 hunks)
  • src/renderer/src/i18n/zh-TW/settings.json (2 hunks)
  • src/renderer/src/lib/utils.ts (1 hunks)
  • src/renderer/src/stores/settings.ts (1 hunks)
  • src/shared/presenter.d.ts (8 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
src/renderer/src/**/*

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/i18n.mdc
src/renderer/src/i18n/**/*.json

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/i18n.mdc
src/renderer/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
**/*.{js,jsx,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development-setup.mdc
**/*.{ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/error-logging.mdc
src/main/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
src/main/presenter/**/*.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
{src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
src/main/presenter/index.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/pinia-best-practices.mdc
src/main/presenter/llmProviderPresenter/providers/*.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/llm-agent-loop.mdc
src/main/presenter/llmProviderPresenter/index.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/llm-agent-loop.mdc
src/shared/*.d.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
src/shared/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
🧠 Learnings (55)
src/renderer/src/i18n/ru-RU/about.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 : 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 : 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')
src/renderer/src/i18n/ja-JP/about.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 : 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 : 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/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/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/components/mcp-config/components/McpServers.vue (1)
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts:250-252
Timestamp: 2025-06-21T15:48:29.950Z
Learning: In the meeting server implementation (src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts), when multiple tabs have the same title, the user prefers to let the code silently select the first match without adding warnings or additional ambiguity handling.
src/renderer/src/components/settings/FastGptKnowledgeSettings.vue (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/**/* : 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/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/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/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
src/main/index.ts (7)
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/error-logging.mdc:0-0
Timestamp: 2025-06-30T12:23:33.814Z
Learning: Applies to **/*.{ts,tsx} : 始终使用 try-catch 处理可能的错误
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/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/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/error-logging.mdc:0-0
Timestamp: 2025-06-30T12:23:33.814Z
Learning: Applies to **/*.{ts,tsx} : 不要吞掉错误
src/renderer/src/components/ModelSelect.vue (1)
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
package.json (1)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-06-30T12:23:01.752Z
Learning: Node.js >= 22
src/renderer/src/i18n/en-US/about.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 : 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
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/about.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 : 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 : 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')
src/renderer/src/i18n/fr-FR/about.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 : 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 : 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)
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/main/presenter/index.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/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/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/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 : Use context isolation for improved security
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/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/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/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/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/**/*.ts : Use Electron's built-in APIs for file system and native dialogs
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/components/settings/DifyKnowledgeSettings.vue (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/**/* : 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/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/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
src/renderer/src/components/FileItem.vue (9)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.336Z
Learning: Import the Icon component from '@iconify/vue' and use it for rendering icons in Vue components.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.336Z
Learning: Use Iconify/Vue for icon implementation, preferring the 'lucide:' icon family, and follow the '{collection}:{icon-name}' naming pattern.
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/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/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: Leverage defineComponent and PropType for strong typing in Vue 3 components.
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/ko-KR/about.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/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/components/settings/RagflowKnowledgeSettings.vue (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/**/* : 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/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/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
src/renderer/src/i18n/zh-CN/about.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 : 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
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/filePresenter/BaseFileAdapter.ts (1)
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
src/main/presenter/mcpPresenter/inMemoryServers/builder.ts (1)
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts:250-252
Timestamp: 2025-06-21T15:48:29.950Z
Learning: In the meeting server implementation (src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts), when multiple tabs have the same title, the user prefers to let the code silently select the first match without adding warnings or additional ambiguity handling.
src/renderer/src/i18n/zh-TW/mcp.json (2)
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
src/renderer/src/i18n/en-US/mcp.json (1)
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
src/renderer/src/i18n/fa-IR/mcp.json (1)
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
src/main/presenter/configPresenter/mcpConfHelper.ts (2)
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts:250-252
Timestamp: 2025-06-21T15:48:29.950Z
Learning: In the meeting server implementation (src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts), when multiple tabs have the same title, the user prefers to let the code silently select the first match without adding warnings or additional ambiguity handling.
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/about.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 : 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
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/mcp.json (2)
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
src/renderer/src/i18n/zh-HK/about.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/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
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/components/settings/KnowledgeFileItem.vue (4)
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} : Use modules to organize related state and actions
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.335Z
Learning: Structure files by separating exported components, composables, helpers, static content, and types for maintainability.
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/i18n/fr-FR/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 : 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/**/* : 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 : Translation key naming must use dot-separated hierarchy, lowercase letters, and meaningful descriptive names (e.g., 'common.button.submit')
src/renderer/src/i18n/zh-HK/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/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/**/* : 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 : Translation key naming must use dot-separated hierarchy, lowercase letters, and meaningful descriptive names (e.g., 'common.button.submit')
src/main/presenter/llmProviderPresenter/baseProvider.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 : 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 : 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 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 : 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 : 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`.
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
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/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')
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
src/main/presenter/configPresenter/knowledgeConfHelper.ts (4)
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/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/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/renderer/src/components/settings/ModelConfigItem.vue (1)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-06-23T13:06:15.336Z
Learning: Use Iconify/Vue for icon implementation, preferring the 'lucide:' icon family, and follow the '{collection}:{icon-name}' naming pattern.
src/renderer/src/lib/utils.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 : Use Electron's built-in APIs for file system and native dialogs
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} : 提供用户友好的错误信息
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/components/settings/OllamaProviderSettingsDetail.vue (13)
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/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} : Keep the store focused on global state, not component-specific data
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.336Z
Learning: Import the Icon component from '@iconify/vue' and use it for rendering icons in Vue components.
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-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/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.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: Leverage defineComponent and PropType for strong typing in Vue 3 components.
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/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/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
src/renderer/src/components/settings/KnowledgeFile.vue (2)
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 Electron's built-in APIs for file system and native dialogs
src/renderer/src/stores/settings.ts (1)
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.
src/main/presenter/llmProviderPresenter/providers/openAICompatibleProvider.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 : 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 : 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 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/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/streamEvents.ts : Define the standardized stream event interface (`LLMCoreStreamEvent`) in a shared location, such as `src/main/presenter/llmProviderPresenter/streamEvents.ts`.
scripts/postinstall.js (1)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-06-30T12:23:01.752Z
Learning: Node.js >= 22
src/main/presenter/llmProviderPresenter/index.ts (9)
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/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 : 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/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/streamEvents.ts : Define the standardized stream event interface (`LLMCoreStreamEvent`) in a shared location, such as `src/main/presenter/llmProviderPresenter/streamEvents.ts`.
src/main/presenter/configPresenter/index.ts (5)
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/**/*.ts : Use context isolation for improved security
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/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/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`.
src/main/presenter/llmProviderPresenter/providers/ollamaProvider.ts (9)
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 : 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 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/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 : `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/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
src/main/presenter/knowledgePresenter/knowledgeStorePresenter.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/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 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 : 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,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
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/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/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
src/main/presenter/filePresenter/FilePresenter.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/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/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/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/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/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/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
src/main/presenter/knowledgePresenter/index.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/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/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/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
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/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/**/*.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 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 : Use Electron's built-in APIs for file system and native dialogs
src/main/presenter/mcpPresenter/inMemoryServers/builtinKnowledgeServer.ts (2)
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.
src/renderer/src/i18n/ja-JP/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/ko-KR/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 : 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/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/main/presenter/knowledgePresenter/database/duckdbPresenter.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/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 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/**/*.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/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 : Use Electron's built-in APIs for file system and native dialogs
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
src/renderer/src/i18n/zh-TW/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 : 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/**/* : 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)
docs/builtin-knowledge-design.md (1)
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/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 : 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/en-US/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 : 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/KnowledgeBaseSettings.vue (1)
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
src/shared/presenter.d.ts (14)
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/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 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/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/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 : 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/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/development-setup.mdc:0-0
Timestamp: 2025-06-30T12:23:01.752Z
Learning: Node.js >= 22
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/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/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.
🧬 Code Graph Analysis (13)
src/main/index.ts (1)
src/main/presenter/index.ts (1)
  • presenter (180-180)
src/renderer/src/events.ts (1)
src/main/events.ts (1)
  • RAG_EVENTS (177-179)
src/main/events.ts (1)
src/renderer/src/events.ts (1)
  • RAG_EVENTS (128-130)
src/main/presenter/mcpPresenter/inMemoryServers/builder.ts (2)
src/main/presenter/mcpPresenter/inMemoryServers/builtinKnowledgeServer.ts (1)
  • BuiltinKnowledgeServer (15-150)
src/shared/presenter.d.ts (1)
  • BuiltinKnowledgeConfig (1259-1270)
src/main/presenter/llmProviderPresenter/baseProvider.ts (1)
src/shared/presenter.d.ts (1)
  • LLM_EMBEDDING_ATTRS (492-495)
src/main/presenter/configPresenter/knowledgeConfHelper.ts (1)
src/shared/presenter.d.ts (1)
  • BuiltinKnowledgeConfig (1259-1270)
src/main/presenter/llmProviderPresenter/providers/openAICompatibleProvider.ts (2)
src/shared/presenter.d.ts (1)
  • LLM_EMBEDDING_ATTRS (492-495)
src/main/utils/vector.ts (2)
  • EMBEDDING_TEST_KEY (1-1)
  • isNormalized (13-17)
src/main/presenter/llmProviderPresenter/index.ts (1)
src/shared/presenter.d.ts (1)
  • LLM_EMBEDDING_ATTRS (492-495)
src/main/presenter/configPresenter/index.ts (2)
src/main/presenter/configPresenter/knowledgeConfHelper.ts (1)
  • KnowledgeConfHelper (4-51)
src/shared/presenter.d.ts (1)
  • BuiltinKnowledgeConfig (1259-1270)
src/main/presenter/llmProviderPresenter/providers/ollamaProvider.ts (2)
src/shared/presenter.d.ts (2)
  • OllamaModel (861-883)
  • LLM_EMBEDDING_ATTRS (492-495)
src/main/utils/vector.ts (2)
  • EMBEDDING_TEST_KEY (1-1)
  • isNormalized (13-17)
src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (3)
src/shared/presenter.d.ts (3)
  • IVectorDatabasePresenter (1310-1385)
  • KnowledgeFileMessage (1185-1193)
  • QueryResult (1297-1305)
src/main/presenter/index.ts (1)
  • presenter (180-180)
src/main/utils/strings.ts (1)
  • sanitizeText (1-9)
src/main/presenter/filePresenter/FilePresenter.ts (1)
src/shared/chat.d.ts (1)
  • MessageFile (74-82)
src/main/presenter/mcpPresenter/inMemoryServers/builtinKnowledgeServer.ts (2)
src/shared/presenter.d.ts (3)
  • BuiltinKnowledgeConfig (1259-1270)
  • MCPTextContent (970-973)
  • QueryResult (1297-1305)
src/main/presenter/index.ts (1)
  • presenter (180-180)
🪛 Biome (1.9.4)
src/main/presenter/knowledgePresenter/index.ts

[error] 59-60: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (98)
src/renderer/src/lib/utils.ts (1)

18-66: Well-implemented MIME type mapping utility.

The function correctly handles various MIME types with appropriate fallback logic. The extensive conditional checks cover most common file types and provide a sensible default.

src/renderer/src/i18n/zh-TW/about.json (1)

16-20: Translation key follows guidelines correctly.

The new settings.knowledgeBase.deleteSuccess key properly follows the dot-separated hierarchy naming convention and is appropriately placed in the Traditional Chinese locale file.

src/main/index.ts (1)

311-315: Proper resource cleanup with error handling.

The try-catch block correctly implements knowledge presenter cleanup during app shutdown, following the established pattern and coding guidelines for error handling.

package.json (3)

62-63: Appropriate dependencies for LangChain integration.

The @langchain/core and @langchain/textsplitters dependencies are correctly added to support text processing and chunking functionality for the knowledge base.


69-69: Appropriate dependency for date formatting.

The dayjs dependency is correctly added to support date/time formatting in the knowledge base UI components.


57-57: Confirm @duckdb/node-api pre-release version

  • package.json (line 57) pins @duckdb/node-api to 1.3.2-alpha.24, which is a pre-release newer than the latest published 1.2.2-alpha.18.
  • All @duckdb/node-api releases are currently labelled “alpha.” If you require production stability, either:
    • Pin to 1.2.2-alpha.18
    • Confirm that you need features only available in the newer alpha.24
  • For a fully non-alpha DuckDB client, you could use the original duckdb package (v1.3.0), though it’s deprecated in favor of @duckdb/node-api.
src/renderer/src/components/ModelSelect.vue (1)

71-71: Good UX improvement for model selection.

The filtering logic now correctly excludes providers with no models when the search keyword is empty, ensuring users only see relevant providers. This enhancement aligns well with the new knowledge base feature where embedding model selection is crucial.

src/renderer/src/i18n/zh-CN/mcp.json (1)

199-202: Proper Chinese localization for built-in knowledge base.

The translation entry follows the established structure and provides clear Chinese text for the built-in knowledge base search service. The description accurately explains the functionality.

src/renderer/src/i18n/ko-KR/mcp.json (1)

198-202: Korean localization added correctly.

The translation entry follows the established structure and provides appropriate Korean text for the built-in knowledge base search service. The description is comprehensive, though it could be more concise.

src/renderer/src/events.ts (1)

127-130: Event structure follows established conventions.

The new RAG_EVENTS category and FILE_UPDATED event are properly defined following the established naming convention. The event name clearly indicates its purpose for knowledge base file status updates.

src/renderer/src/i18n/zh-TW/mcp.json (1)

219-222: Traditional Chinese localization properly implemented.

The translation entry follows the established structure and provides clear Traditional Chinese text for the built-in knowledge base search service. The description accurately conveys the functionality.

src/renderer/src/components/mcp-config/components/McpServers.vue (1)

184-185: LGTM: Consistent pattern for new built-in knowledge server.

The addition of builtinKnowledge: 'builtinKnowledge' follows the established pattern for special servers and properly integrates with the navigation system to redirect to the knowledge base settings panel.

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

16-19: Confirmed: settings.knowledgeBase.deleteSuccess is present in all locale about.json files.

The new translation key exists with matching structure in en-US/about.json, fa-IR/about.json, fr-FR/about.json, ja-JP/about.json, ko-KR/about.json, ru-RU/about.json, zh-CN/about.json, zh-HK/about.json, and zh-TW/about.json. No further changes required.

src/renderer/src/i18n/zh-HK/mcp.json (1)

199-202: builtinKnowledge entry is present and consistent across all MCP language files

Verified that the builtinKnowledge entry exists with both name and desc fields in all MCP translation files (en-US, fa-IR, fr-FR, ja-JP, ko-KR, ru-RU, zh-CN, zh-HK, zh-TW). No further changes needed.

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

125-127: LGTM: UI consistency improvement with DialogDescription.

The addition of DialogDescription component improves UI consistency across knowledge base settings dialogs.


201-202: LGTM: Correct import for DialogDescription.

The DialogDescription import is correctly added to support the new UI component.

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

199-202: Consistency Verified: builtinKnowledge Present in All MCP Language Files

All mcp.json files under src/renderer/src/i18n/*/mcp.json include the inmemory.builtinKnowledge entry with both name and desc fields, matching the established structure:

• en-US
• fa-IR
• fr-FR
• ja-JP
• ko-KR
• ru-RU
• zh-CN
• zh-HK
• zh-TW

No further changes needed.

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

199-202: LGTM! Translation structure is consistent.

The new builtinKnowledge entry follows the existing pattern in the inmemory section with proper name and desc fields. The French translations are appropriate and the key naming is consistent with other entries in the file.

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

43-43: LGTM! Good use of conditional rendering.

The v-if="changeable" condition provides appropriate control over the settings button visibility.


93-97: LGTM! Well-structured prop definition.

The changeable prop is properly defined with a boolean type and sensible default value of true, maintaining backward compatibility while providing flexibility for different use cases.

src/renderer/src/components/settings/DifyKnowledgeSettings.vue (3)

125-127: Good UI enhancement with proper i18n usage.

The addition of DialogDescription improves the dialog's user experience by providing contextual information. The translation key usage follows the established i18n patterns.


132-132: Appropriate label text refinement.

The change from difyDescription to descriptionDesc creates a more specific and descriptive label for the input field, improving clarity.


201-202: Correct import addition.

The DialogDescription import is properly added alongside existing dialog components.

src/renderer/src/i18n/ru-RU/mcp.json (1)

198-202: Proper translation structure for built-in knowledge feature.

The new builtinKnowledge entry follows the established pattern with appropriate Russian translations. The structure is consistent with other in-memory service entries.

src/renderer/src/i18n/fa-IR/mcp.json (1)

198-202: Consistent translation structure for Persian locale.

The new builtinKnowledge entry maintains structural consistency with other language files and follows the established pattern. The Persian translations are appropriately integrated.

src/renderer/src/i18n/ru-RU/about.json (1)

15-20: Well-structured translation addition.

The new nested structure settings.knowledgeBase.deleteSuccess follows the dot-separated hierarchy pattern correctly and provides an appropriate Russian translation for the delete success message.

src/renderer/src/components/FileItem.vue (2)

47-47: Good addition of centralized utility import.

Importing the getMimeTypeIcon utility promotes code reusability and maintainability across the application.


68-68: Excellent refactoring to use centralized utility.

The simplification of the getFileIcon function to use the centralized getMimeTypeIcon utility reduces code duplication and improves maintainability. This follows the DRY principle effectively.

src/renderer/src/components/settings/RagflowKnowledgeSettings.vue (3)

125-127: LGTM: Proper dialog description implementation

Good addition of the DialogDescription component to provide contextual information in the dialog header. The use of the i18n translation key is consistent with coding guidelines.


132-132: LGTM: Label translation key update

The change from ragflowDescription to descriptionDesc appears to be a more specific and descriptive translation key for the input field label.


201-202: LGTM: Correct import addition

The DialogDescription component is properly imported from the UI dialog components to support the new functionality.

src/main/presenter/configPresenter/mcpConfHelper.ts (1)

142-153: LGTM: Consistent server configuration addition

The new builtinKnowledge server configuration follows the established pattern of other knowledge base servers. The configuration properly includes:

  • Chinese description for built-in knowledge retrieval service
  • Appropriate book icon (📚) consistent with other knowledge services
  • Auto-approval for all operations (appropriate for internal service)
  • Correct inmemory type and command mapping
  • Empty configs array for initialization
src/main/presenter/index.ts (3)

24-24: LGTM: Proper import addition

The KnowledgePresenter import is correctly added following the established import pattern.


58-58: LGTM: Consistent property declaration

The knowledgePresenter property is properly declared following the same pattern as other presenter properties.


87-87: LGTM: Proper presenter instantiation

The KnowledgePresenter is correctly instantiated with appropriate dependencies (configPresenter and dbDir). The initialization follows the established pattern and provides the necessary dependencies for knowledge base functionality.

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

15-20: LGTM: Proper i18n key structure

The new translation key settings.knowledgeBase.deleteSuccess follows the correct dot-separated hierarchy pattern as per coding guidelines. The Traditional Chinese translation "刪除成功" (Delete Success) is appropriate for the context.


15-20: settings.knowledgeBase.deleteSuccess is defined in all locale settings.json files

The settings.knowledgeBase.deleteSuccess key exists in each supported language’s settings.json. No missing translations were found.

src/main/presenter/filePresenter/BaseFileAdapter.ts (1)

71-71: LGTM: Consistent access modifier alignment

Changing the getContent() method from protected to public aligns its visibility with other abstract methods (getLLMContent() and getThumbnail()). This change supports the enhanced file preparation workflows while maintaining consistency in the interface design.

src/renderer/src/i18n/fa-IR/about.json (1)

16-20: Localization key consistency verified across all languages

The new key settings.knowledgeBase.deleteSuccess is present in every about.json file under src/renderer/src/i18n/ and correctly returns a localized string in each language. All files share the same nesting and naming convention.

Approved for merge.

src/main/presenter/mcpPresenter/inMemoryServers/builder.ts (2)

15-16: Import statements follow consistent pattern.

The new imports for BuiltinKnowledgeServer and BuiltinKnowledgeConfig are properly organized and follow the established import pattern in the file.


74-79: Implementation follows established pattern.

The new builtinKnowledge case follows the same pattern as other knowledge base server types in the file. The type casting approach is consistent with existing implementations like difyKnowledge, ragflowKnowledge, and fastGptKnowledge.

src/renderer/src/i18n/en-US/mcp.json (1)

195-198: Localization entry follows established pattern.

The new builtinKnowledge entry follows the same structure and naming conventions as other in-memory server entries. The description clearly explains the functionality and purpose of the built-in knowledge base search service.

src/renderer/src/i18n/ko-KR/about.json (1)

16-20: Translation key maintains consistency across languages.

The new translation key "settings.knowledgeBase.deleteSuccess" follows the proper dot-separated hierarchy naming convention and maintains structural consistency with other language files, as required by the coding guidelines.

src/renderer/src/components/settings/KnowledgeFileItem.vue (1)

1-119: LGTM with minor improvements needed.

The component follows Vue best practices well:

  • Proper use of Composition API with TypeScript
  • Correct i18n usage for all user-facing strings
  • Appropriate event handling and props structure
  • Good use of dayjs for timezone-aware date formatting
  • Clean component structure with proper separation of concerns

The only issues are the Chinese comments that need to be converted to English per coding guidelines.

src/renderer/src/i18n/zh-CN/settings.json (3)

183-186: LGTM: Well-structured toast message additions.

The new toast message entries follow proper naming conventions and provide appropriate Chinese translations for model running status notifications.


312-361: LGTM: Comprehensive knowledge base localization.

The extensive knowledge base translations are well-organized and complete:

  • Proper dot-separated hierarchy naming convention
  • Comprehensive coverage of all UI elements
  • Appropriate Chinese translations for technical terms
  • Good structure with logical grouping of related terms

The translations properly support the new built-in knowledge base feature with all necessary UI text, error messages, and helper descriptions.


288-288: Verified: knowledgeBase translation keys are consistent across all locales
All keys in src/renderer/src/i18n/zh-CN/settings.json match those in en-US and fr-FR.

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

9-11: LGTM: Proper import addition for embedding support.

The addition of LLM_EMBEDDING_ATTRS import is well-placed and supports the new embedding dimension functionality required for the built-in knowledge base feature.


609-616: LGTM: Consistent parameter naming and error message.

The parameter renaming with underscore prefixes follows TypeScript convention for unused parameters, and the error message is now consistent with the new getDimensions method.


618-625: LGTM: Well-designed API for embedding dimensions.

The new getDimensions method provides a clean interface for retrieving embedding vector dimensions. The implementation:

  • Uses appropriate TypeScript typing with LLM_EMBEDDING_ATTRS
  • Provides consistent error handling with the base class pattern
  • Follows the same naming convention as other abstract methods
  • Supports the built-in knowledge base feature requirements
src/renderer/src/i18n/fr-FR/settings.json (3)

279-282: LGTM: Well-translated toast messages.

The new French toast message entries provide appropriate translations for model running status notifications and follow proper naming conventions.


312-361: LGTM: Comprehensive French knowledge base translations.

The extensive French translations for the knowledge base feature are well-executed:

  • Proper technical term translations (e.g., "Base de connaissances intégrée" for "Built-in Knowledge Base")
  • Consistent structure with other language files
  • Complete coverage of all UI elements, error messages, and helper text
  • Good use of French technical vocabulary for embedding, chunking, and reranking concepts

The translations properly support the new built-in knowledge base feature with appropriate French localization.


278-283: Translation key consistency verified

All new keys are present and match exactly across all language files, so there’s no discrepancy:

  • refreshingModels found in zh-CN (line 168), en-US (line 278), fr-FR (line 278)
  • provider.toast.modelRunning and provider.toast.modelRunningDesc are identical in zh-CN, en-US, and fr-FR

No further action required.

src/main/presenter/configPresenter/modelDefaultSettings.ts (3)

1673-1684: LGTM! New all-minilm embedding model configuration is well-structured.

The new embedding model configuration follows the established pattern and includes all necessary fields for an embedding model.


1665-1666: Consider full 8,192-token capacity for nomic-embed-text

According to Nomic’s API docs, the nomic-embed-text model supports up to 8,192 input tokens, but the config here caps it at 2,048:

• File: src/main/presenter/configPresenter/modelDefaultSettings.ts
Lines ~1665–1666

    maxTokens: 2048,
    contextLength: 2048,

Please confirm that reducing the limit to 2,048 is intentional (e.g., for performance or cost) and still meets your knowledge-base requirements. If you need longer context windows, consider increasing these values up to the model’s 8,192-token maximum.


1689-1690: No action needed for embedding token limits

The maxTokens and contextLength values on the generic embedding model in modelDefaultSettings.ts are only metadata and aren’t enforced by the embedding flow. In practice:

  • Text is split by RecursiveCharacterTextSplitter using config.chunkSize, not contextLength.
  • The OpenAI-compatible provider’s getEmbeddings call does not accept or enforce a max_tokens parameter.

Since reducing these metadata values from 4096 to 1024 has no impact on actual embedding requests, no further verification or change is required.

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

278-282: LGTM! Toast message translations are well-structured.

The provider toast messages for model running state follow proper i18n conventions with descriptive keys.


312-361: Excellent comprehensive localization for built-in knowledge base functionality.

The added translations cover all aspects of the knowledge base feature including:

  • Configuration management
  • File upload and processing states
  • Search interface
  • Error handling
  • Advanced settings

The key naming follows the established dot-separated hierarchy pattern and uses meaningful descriptive names as required by the coding guidelines.

src/main/presenter/configPresenter/knowledgeConfHelper.ts (1)

1-14: LGTM! Clean constructor and store initialization.

The constructor properly initializes the ElectronStore with appropriate defaults and typing.

src/main/presenter/filePresenter/FilePresenter.ts (2)

109-120: LGTM! Clean content type handling with proper switch statement.

The switch statement properly handles different content types and provides appropriate fallback behavior.


153-155: Good backward compatibility preservation.

The refactored prepareFile method maintains backward compatibility while leveraging the new flexible method.

src/main/utils/vector.ts (2)

1-1: LGTM! Well-defined constant for embedding testing.

The EMBEDDING_TEST_KEY constant provides a consistent test input for embedding operations.


3-5: LGTM! Mathematically correct L2 norm calculation.

The calcNorm function correctly implements the Euclidean (L2) norm calculation.

src/main/presenter/llmProviderPresenter/index.ts (3)

10-11: LGTM: Import additions are appropriate.

The new imports KeyStatus and LLM_EMBEDDING_ATTRS are correctly added to support the new getDimensions method functionality.


1188-1211: LGTM: Well-implemented getDimensions method.

The new method follows best practices:

  • Proper error handling with try-catch
  • Meaningful error logging
  • Consistent return structure with data/errorMsg pattern
  • Graceful fallback with default values on error
  • Comprehensive JSDoc documentation

The implementation correctly delegates to the provider instance and handles failures appropriately.


1175-1186: Parameter order change verified—no breaking usage found

  • src/shared/presenter.d.ts declares getEmbeddings(providerId: string, modelId: string, texts: string[])
  • All presenter call sites now pass (providerId, modelId, texts):
    • src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (vectors and similarityQuery)
  • Provider implementations (openAICompatibleProvider, ollamaProvider, etc.) still use (texts, modelId) internally and are unaffected.

The added try-catch for error handling is appropriate and provides clearer error messages.

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

1025-1025: LGTM: Direct property access for contextLength.

The change from fallback logic to direct property access (model.model_info.context_length) is more reliable and aligns with the enhanced model metadata provided by the updated Ollama provider.


1032-1035: LGTM: Capability-based property assignment.

The changes improve accuracy by:

  • Directly checking the capabilities array for specific capabilities ('vision', 'tools', 'thinking', 'embedding')
  • Using indexOf checks instead of relying on existing values or defaults
  • Dynamically setting model type based on embedding capability
  • Ensuring boolean values are properly derived from capability presence

This approach is more reliable and consistent with the enhanced model metadata structure.

src/main/presenter/llmProviderPresenter/providers/openAICompatibleProvider.ts (3)

1-1: LGTM: Import additions align with new embedding functionality.

The new imports for vector utilities and embedding types are properly integrated to support the enhanced embedding capabilities.


1290-1291: Good: Explicit encoding format specification.

Adding encoding_format: 'float' ensures consistent float vector format from the OpenAI embeddings API, which is important for vector similarity operations.


1297-1317: Well-implemented dimensions detection method.

The getDimensions method provides a robust approach:

  • Uses hardcoded values for well-known models (efficient)
  • Falls back to dynamic detection for unknown models
  • Properly integrates with the isNormalized utility function
  • Returns the expected LLM_EMBEDDING_ATTRS interface

The implementation handles both known and unknown models appropriately, supporting the built-in knowledge base system's embedding requirements.

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

169-183: LGTM: Proper Vue 3 composition API setup.

The component correctly uses Vue 3 composition API with proper imports and i18n integration. The component structure follows Vue best practices.


244-255: Good: Reusable file handling logic.

The handleChange method cleverly reuses the drag-and-drop logic by creating a fake DragEvent object. This reduces code duplication and ensures consistent file handling behavior.


279-314: Well-implemented file upload with validation.

The drag-and-drop file upload includes:

  • Proper file extension validation
  • User-friendly error messages via toast notifications
  • Asynchronous file processing with error handling
  • Integration with the knowledge presenter for backend communication

The implementation handles edge cases well and provides good user feedback.


263-277: LGTM: Proper lifecycle management and event handling.

The component correctly:

  • Initializes the file list on mount
  • Sets up IPC event listeners for real-time updates
  • Cleans up event listeners on unmount to prevent memory leaks

The event handling pattern follows Electron best practices for IPC communication.

src/renderer/src/components/settings/OllamaProviderSettingsDetail.vue (3)

384-426: Well-designed computed property for model display.

The displayLocalModels computed property effectively:

  • Combines local models with pulling progress information
  • Creates placeholder entries for models being pulled but not yet listed locally
  • Adds required metadata fields with sensible defaults
  • Implements proper sorting (pulling models first, then alphabetical)

This provides a unified view of both existing and downloading models.


115-149: Good: Enhanced UI for model states.

The template properly handles different model states:

  • Uses ModelConfigItem component for stable models with full configuration
  • Shows progress bars for models being pulled
  • Displays appropriate status indicators and badges
  • Maintains consistent styling and layout

The conditional rendering based on pulling state provides clear visual feedback to users.


455-463: Excellent: Prevents deletion of running models.

The check for running models before deletion is a good safety measure that:

  • Prevents accidental deletion of active models
  • Provides helpful feedback via toast notification
  • Uses proper i18n keys for user messages
  • Follows the existing error handling pattern

This improves the user experience by preventing potential issues.

src/main/presenter/configPresenter/index.ts (1)

84-84: Well-structured knowledge configuration management

The implementation follows the established pattern of using helper classes and properly delegates configuration management to KnowledgeConfHelper. The separation of concerns is maintained effectively.

Also applies to: 130-132, 1056-1073

docs/builtin-knowledge.md (1)

1-100: Comprehensive module documentation

The documentation provides a clear and detailed overview of the BuiltinKnowledge module architecture, including data flow diagrams and component descriptions. Well-structured and informative.

src/main/presenter/llmProviderPresenter/providers/ollamaProvider.ts (1)

1170-1177: Clean embedding dimension detection

The getDimensions method provides a clean way to detect embedding vector dimensions and normalization status using a test key. Good implementation.

src/renderer/src/components/settings/KnowledgeBaseSettings.vue (1)

32-33: Well-integrated builtin knowledge base UI

The component properly integrates the builtin knowledge base feature with:

  • Conditional rendering for detail view
  • Proper event handling for showing details
  • Clean dialog option for builtin knowledge type
  • Correct component references and type imports

Also applies to: 87-100, 110-116, 137-139, 144-144, 147-153, 171-175

src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (1)

14-145: Well-architected knowledge store implementation

The KnowledgeStorePresenter class demonstrates good software engineering practices:

  • Clean separation of file metadata handling and async vector processing
  • Proper error handling with status updates
  • Well-structured dependency injection
  • Clear method responsibilities

The architecture effectively manages the complexity of file processing, embedding generation, and vector storage.

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

278-282: LGTM!

The toast notification keys follow the proper naming conventions with dot-separated hierarchy and meaningful descriptive names.


311-360: LGTM!

The built-in knowledge base localization keys are well-structured and follow the naming conventions consistently. The keys provide comprehensive coverage for the new feature including configuration options, UI elements, and error messages.

src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts (1)

22-302: Excellent implementation with robust error handling

The DuckDBPresenter implementation demonstrates excellent practices:

  • Comprehensive error handling with meaningful error messages
  • SQL injection prevention through parameterized queries
  • Proper resource cleanup in close() and destroy() methods
  • Detailed logging for debugging

The vector database operations are well-structured and the code is maintainable.

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

278-360: LGTM! Translation keys are consistent

The Japanese translation file maintains perfect consistency with the English translation file structure. All new keys for the toast notifications and built-in knowledge base feature are present and follow the same naming conventions.

src/main/presenter/knowledgePresenter/index.ts (1)

18-250: Well-structured implementation with good patterns

The KnowledgePresenter implementation demonstrates excellent design patterns:

  • Proper separation of concerns with cache management
  • Comprehensive error handling with meaningful error messages
  • Event-driven architecture for configuration synchronization
  • Resource cleanup in closeAll() method
  • Good use of async/await patterns

The architecture aligns well with the documented design.

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

278-361: Translation keys follow proper naming conventions

The new translation keys for the built-in knowledge base feature follow the established dot-separated hierarchy pattern and maintain consistency with the existing structure.

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

278-361: Consistent translation structure maintained

The Traditional Chinese translations maintain the same key structure as other language files, ensuring consistency across all supported languages.

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

731-740: Excellent error handling implementation

The component implements comprehensive error handling with try-catch blocks and provides meaningful error messages to users through toast notifications.

Also applies to: 833-842, 846-866


16-16: Use English for comments

Comments should be written in English according to the coding guidelines.

-        <!-- MCP开关 -->
+        <!-- MCP switch -->
⛔ Skipped due to learnings
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/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 : 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/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/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
src/renderer/src/i18n/ru-RU/settings.json (1)

278-361: Translation structure consistency maintained

The Russian translations follow the same key structure as other language files, ensuring proper internationalization support.

src/main/presenter/mcpPresenter/inMemoryServers/builtinKnowledgeServer.ts (2)

54-149: Well-structured MCP server implementation

The server implementation properly handles multiple knowledge bases, validates inputs, and provides comprehensive error handling. The logic for tool registration and invocation is sound.


19-35: Robust error handling implementation

The error handling is well-implemented with proper validation in the constructor and graceful error responses in the tool handlers. Errors are caught and returned as text content rather than throwing exceptions, which is appropriate for an MCP server.

Also applies to: 67-101, 103-149

src/renderer/src/i18n/fa-IR/settings.json (1)

278-282: Translation keys follow proper naming conventions.

The new provider toast notification keys are properly structured using dot-separated hierarchy and lowercase letters.

docs/builtin-knowledge-design.md (1)

1-222: Well-structured design document with clear architecture.

The design document provides a comprehensive overview of the BuiltinKnowledge module with:

  • Clear separation of concerns between presenters
  • Well-defined interfaces and responsibilities
  • Good use of sequence diagrams to illustrate workflows
  • Event-driven architecture for configuration synchronization
  • Extensibility guidelines for future enhancements
src/shared/presenter.d.ts (1)

314-314: Well-structured type definitions for knowledge base functionality.

The new interfaces and type extensions are comprehensive and follow TypeScript best practices:

  • Clear interface segregation with IKnowledgePresenter and IVectorDatabasePresenter
  • Proper type definitions for configuration, file metadata, and query results
  • Good integration with existing presenter interfaces
  • Comprehensive documentation with JSDoc comments

Also applies to: 430-436, 492-495, 543-547, 840-844, 875-883, 1177-1385

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: 1

♻️ Duplicate comments (19)
src/main/presenter/knowledgePresenter/index.ts (19)

20-21: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English. The current Chinese comments need translation.

Apply this diff to translate the comment:

-  /**
-   * 知识库存储目录
-   */
+  /**
+   * Knowledge base storage directory
+   */

36-37: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-  /**
-   * 初始化知识库存储目录
-   */
+  /**
+   * Initialize knowledge base storage directory
+   */

44-45: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-    // 监听知识库相关事件
+    // Listen to knowledge base related events

64-65: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-          // 处理新增、删除和更新的配置
+          // Handle added, deleted and updated configurations

74-75: Implement handling for updated configurations.

The handler for updated configurations is empty, which could lead to inconsistent state if knowledge base configurations are modified.

Would you like me to help implement the logic for handling updated configurations? This might involve updating the existing KnowledgeStorePresenter instances with new configuration values.


87-88: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-  /**
-   * 创建知识库(初始化 RAG 应用)
-   */
+  /**
+   * Create knowledge base (initialize RAG application)
+   */

94-95: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-  /**
-   * 删除知识库(移除本地存储)
-   */
+  /**
+   * Delete knowledge base (remove local storage)
+   */

109-110: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-  /**
-   * 缓存 RAG 应用实例
-   */
+  /**
+   * Cache RAG application instances
+   */

114-117: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-  /**
-   * 创建 RAG 应用实例
-   * @param params BuiltinKnowledgeConfig
-   * @returns KnowledgeStorePresenter
-   */
+  /**
+   * Create RAG application instance
+   * @param config BuiltinKnowledgeConfig
+   * @returns KnowledgeStorePresenter
+   */

136-138: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-  /**
-   * 获取 RAG 应用实例
-   * @param id 知识库 ID
-   */
+  /**
+   * Get RAG application instance
+   * @param id Knowledge base ID
+   */

140-141: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-    // 缓存命中直接返回
+    // Return directly if cache hit

144-145: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-    // 获取配置
+    // Get configuration

150-151: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-    // DuckDB 存储
+    // DuckDB storage

152-153: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-    // 创建 RAG 应用实例
+    // Create RAG application instance

159-163: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-  /**
-   * 获取向量数据库实例
-   * @param id 知识库 ID
-   * @param dimensions 向量维度
-   * @returns
-   */
+  /**
+   * Get vector database instance
+   * @param id Knowledge base ID
+   * @param dimensions Vector dimensions
+   * @returns
+   */

175-176: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-    // 如果数据库不存在,则初始化
+    // If database doesn't exist, initialize it

196-197: Translate Chinese comments to English.

According to the coding guidelines, comments should be written in English.

Apply this diff to translate the comment:

-          // 可选:记录异步任务异常
+          // Optional: log async task exceptions

213-214: Translate Chinese error messages to English.

According to the coding guidelines, error messages should be in English.

Apply this diff to translate the error message:

-      '添加文件失败'
+      'Failed to add file'

226-227: Translate Chinese error messages to English.

According to the coding guidelines, error messages should be in English.

Apply this diff to translate the error message:

-      '重新添加文件失败'
+      'Failed to re-add file'
🧹 Nitpick comments (2)
src/main/utils/vector.ts (1)

13-20: Use Number.isFinite for better type safety.

The static analysis tool correctly suggests using Number.isFinite instead of isFinite to avoid type coercion issues.

Apply this diff to improve type safety:

-  if (vector.some((v) => typeof v !== 'number' || !isFinite(v))) return false
+  if (vector.some((v) => typeof v !== 'number' || !Number.isFinite(v))) return false
src/main/presenter/knowledgePresenter/index.ts (1)

59-60: Use optional chaining for cleaner code.

The static analysis tool suggests using optional chaining to simplify the condition.

Apply this diff to use optional chaining:

-        if (builtinConfig && builtinConfig.env && Array.isArray(builtinConfig.env.configs)) {
+        if (builtinConfig?.env && Array.isArray(builtinConfig.env.configs)) {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 54403d5 and 014eb4b.

📒 Files selected for processing (6)
  • scripts/postinstall.js (1 hunks)
  • src/main/presenter/index.ts (4 hunks)
  • src/main/presenter/knowledgePresenter/index.ts (1 hunks)
  • src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (1 hunks)
  • src/main/utils/vector.ts (1 hunks)
  • src/shared/presenter.d.ts (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/presenter/index.ts
  • src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development-setup.mdc
src/main/presenter/**/*.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
{src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
**/*.{ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/error-logging.mdc
src/main/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
src/shared/*.d.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
src/shared/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
🧠 Learnings (3)
scripts/postinstall.js (3)
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/error-logging.mdc:0-0
Timestamp: 2025-06-30T12:23:33.814Z
Learning: Applies to **/*.{ts,tsx} : 始终使用 try-catch 处理可能的错误
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/main/presenter/knowledgePresenter/index.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/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/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/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
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/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/**/*.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 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/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/main/presenter/**/*.ts : Use Electron's built-in APIs for file system and native dialogs
src/shared/presenter.d.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/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/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 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/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/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 : 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/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/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/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/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.
🧬 Code Graph Analysis (1)
src/shared/presenter.d.ts (1)
src/shared/chat.d.ts (1)
  • MessageFile (74-82)
🪛 Biome (1.9.4)
src/main/presenter/knowledgePresenter/index.ts

[error] 59-60: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

src/main/utils/vector.ts

[error] 19-19: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.

(lint/suspicious/noGlobalIsFinite)

🔇 Additional comments (16)
src/main/utils/vector.ts (4)

1-1: LGTM: Clear constant definition.

The EMBEDDING_TEST_KEY constant is well-defined and provides a clear test key for embedding operations.


3-5: LGTM: Efficient norm calculation.

The calcNorm function correctly implements the Euclidean (L2) norm calculation using the standard mathematical formula.


26-35: LGTM: Proper error handling implemented.

The normalized function correctly handles edge cases with appropriate input validation and zero vector detection, addressing previous review concerns.


42-55: LGTM: Comprehensive validation and optimization.

The ensureNormalized function properly validates inputs and optimizes by returning the original vector when already normalized, addressing previous review concerns.

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

313-313: LGTM: Proper integration of knowledge presenter.

The addition of knowledgePresenter: IKnowledgePresenter to the main IPresenter interface correctly integrates the new built-in knowledge base functionality.


428-435: LGTM: Well-designed knowledge configuration methods.

The new methods in IConfigPresenter for knowledge base configuration management are well-structured, providing get, set, and diff operations that align with the knowledge base lifecycle requirements.


491-494: LGTM: Clear embedding attributes type definition.

The LLM_EMBEDDING_ATTRS type properly defines the dimensional and normalization attributes needed for embedding operations.


542-546: LGTM: Comprehensive embedding methods integration.

The new methods getEmbeddings and getDimensions in ILlmProviderPresenter properly extend the interface to support the embedding functionality required by the knowledge base system.


848-852: LGTM: Enhanced file preparation method.

The new prepareFileCompletely method in IFilePresenter with optional contentType parameter provides flexibility for different content processing needs in the knowledge base system.


1212-1233: LGTM: Comprehensive knowledge file types.

The new types KnowledgeFileMetadata, KnowledgeFileStatus, KnowledgeFileMessage, and KnowledgeFileResult provide a complete type foundation for knowledge base file management operations.


1235-1292: LGTM: Well-documented knowledge presenter interface.

The IKnowledgePresenter interface is comprehensive and well-documented, providing all necessary methods for knowledge base lifecycle management, file operations, and similarity queries.


1294-1309: LGTM: Complete knowledge base configuration type.

The BuiltinKnowledgeConfig type provides all necessary configuration parameters for knowledge base setup, including embedding models, dimensions, chunking parameters, and enablement status.


1310-1344: LGTM: Comprehensive vector database operation types.

The types IndexOptions, InsertOptions, QueryOptions, and QueryResult provide complete support for vector database operations required by the knowledge base system.


1346-1424: LGTM: Complete vector database presenter interface.

The IVectorDatabasePresenter interface is comprehensive and well-documented, providing all necessary methods for vector database lifecycle management, vector operations, and file management.

scripts/postinstall.js (2)

6-42: Excellent improvements to error handling and async patterns.

The script has been significantly improved based on previous feedback. The implementation now properly uses async/await patterns, includes comprehensive error handling with meaningful error messages, validates the extension installation results, and exits with appropriate status codes on failure.


44-45: Script execution structure looks good.

The script properly logs the postinstall phase and executes the main function. The structure is clean and follows Node.js script conventions.

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: 0

♻️ Duplicate comments (2)
src/main/presenter/knowledgePresenter/index.ts (2)

74-75: Implement handling for updated configurations.

The handler for updated configurations is empty. This could lead to inconsistent state if knowledge base configurations are modified.

Would you like me to help implement the logic for handling updated configurations? This might involve updating the existing KnowledgeStorePresenter instances with new configuration values.


20-21: Translate comments to English.

According to the coding guidelines, comments should be written in English. Please translate all Chinese comments in this file to maintain consistency.

Also applies to: 36-37, 87-88, 95-95, 109-110, 114-117, 136-138, 159-163

🧹 Nitpick comments (2)
src/main/utils/vector.ts (1)

16-16: Use Number.isFinite for better type safety.

The static analysis tool correctly identifies that isFinite performs type coercion, which can lead to unexpected behavior. Use Number.isFinite instead for strict type checking.

-  if (vector.some((v) => typeof v !== 'number' || !isFinite(v))) return false
+  if (vector.some((v) => typeof v !== 'number' || !Number.isFinite(v))) return false
src/main/presenter/knowledgePresenter/index.ts (1)

59-60: Use optional chaining for safer property access.

The static analysis tool correctly identifies that optional chaining would be more concise and safe here.

-        if (builtinConfig && builtinConfig.env && Array.isArray(builtinConfig.env.configs)) {
+        if (builtinConfig?.env && Array.isArray(builtinConfig.env.configs)) {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 54403d5 and 014eb4b.

📒 Files selected for processing (6)
  • scripts/postinstall.js (1 hunks)
  • src/main/presenter/index.ts (4 hunks)
  • src/main/presenter/knowledgePresenter/index.ts (1 hunks)
  • src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (1 hunks)
  • src/main/utils/vector.ts (1 hunks)
  • src/shared/presenter.d.ts (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/presenter/index.ts
  • scripts/postinstall.js
  • src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development-setup.mdc
src/main/presenter/**/*.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
{src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
**/*.{ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/error-logging.mdc
src/main/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
src/shared/*.d.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
src/shared/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
🧠 Learnings (2)
src/main/presenter/knowledgePresenter/index.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/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/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/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
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/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/**/*.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 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/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/main/presenter/**/*.ts : Use Electron's built-in APIs for file system and native dialogs
src/shared/presenter.d.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/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/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 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/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/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 : 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/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/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/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/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.
🪛 Biome (1.9.4)
src/main/presenter/knowledgePresenter/index.ts

[error] 59-60: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

src/main/utils/vector.ts

[error] 19-19: isFinite is unsafe. It attempts a type coercion. Use Number.isFinite instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isFinite instead.

(lint/suspicious/noGlobalIsFinite)

🔇 Additional comments (9)
src/main/utils/vector.ts (1)

1-55: Excellent implementation of vector normalization utilities.

The vector utility functions are well-implemented with proper input validation, error handling, and edge case management. The functions correctly handle empty vectors, zero vectors, and invalid inputs with appropriate error messages. This provides a robust foundation for the built-in knowledge base system.

src/main/presenter/knowledgePresenter/index.ts (2)

183-207: Well-designed async file operation handler.

The handleFileTask method provides excellent abstraction for file operations with proper error handling and event emission. The pattern of returning immediate data while handling async tasks separately is well-suited for UI responsiveness.


44-84: Robust event handling and configuration management.

The event bus setup and configuration change handling demonstrate proper event-driven architecture. The error handling and logging provide good debugging capabilities for the knowledge base system.

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

313-313: Excellent integration of knowledge presenter interface.

The addition of knowledgePresenter: IKnowledgePresenter to the main IPresenter interface properly integrates the new built-in knowledge base system into the presenter architecture.


428-435: Well-defined knowledge configuration management interface.

The extension of IConfigPresenter with knowledge configuration methods provides a clean interface for managing knowledge base configurations with proper diffing capabilities.


491-494: Appropriate embedding attributes type definition.

The LLM_EMBEDDING_ATTRS type correctly captures the essential properties of embedding vectors (dimensions and normalization status) needed for the knowledge base system.


542-547: Comprehensive LLM provider interface extensions.

The addition of getEmbeddings and getDimensions methods to ILlmProviderPresenter properly extends the interface to support the embedding capabilities required by the knowledge base system.


848-852: Enhanced file presenter interface.

The prepareFileCompletely method with flexible contentType parameter provides good abstraction for different file processing modes needed by the knowledge base system.


1212-1424: Comprehensive built-in knowledge base type definitions.

The extensive type definitions for the built-in knowledge base system are well-structured and comprehensive. They cover all aspects of knowledge management including:

  • File metadata and status tracking
  • Knowledge base configuration with embedding and reranking models
  • Vector database operations with proper indexing and querying options
  • Query results with distance metrics

The interfaces properly define the contracts for the knowledge presenter, vector database operations, and related functionality. The type definitions align well with the implementation patterns seen in the other files.

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: 6

♻️ Duplicate comments (6)
src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (3)

28-28: Fix Chinese error message to English

According to the coding guidelines, logs and error messages should be written in English.


96-96: Fix Chinese error message to English

According to the coding guidelines, logs and error messages should be written in English.


125-125: Fix Chinese error message to English

According to the coding guidelines, logs and error messages should be written in English.

src/main/presenter/knowledgePresenter/index.ts (3)

20-21: Translate Chinese comments to English

According to the coding guidelines, comments should be written in English.


75-76: Implement handling for updated configurations

The handler for updated configurations is empty, which could lead to inconsistent state when knowledge base configurations are modified.


36-37: Translate all Chinese comments to English

According to the coding guidelines, comments should be written in English to maintain consistency.

-  /**
-   * 初始化知识库存储目录
-   */
+  /**
+   * Initialize knowledge base storage directory
+   */

Apply similar translations to all other Chinese comments throughout the file.

Also applies to: 87-88, 95-95, 109-110, 114-117, 136-138, 159-163

🧹 Nitpick comments (1)
src/main/presenter/knowledgePresenter/index.ts (1)

60-61: Optimize with optional chain

The static analysis tool suggests using optional chain for better code safety and readability.

-        if (builtinConfig && builtinConfig.env && Array.isArray(builtinConfig.env.configs)) {
+        if (builtinConfig?.env && Array.isArray(builtinConfig.env.configs)) {
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 014eb4b and c514d99.

📒 Files selected for processing (4)
  • src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts (1 hunks)
  • src/main/presenter/knowledgePresenter/index.ts (1 hunks)
  • src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (1 hunks)
  • src/shared/presenter.d.ts (7 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development-setup.mdc
src/main/presenter/**/*.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
{src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
**/*.{ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/error-logging.mdc
src/main/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
src/shared/*.d.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
src/shared/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
🧠 Learnings (3)
src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (20)
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/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 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 : 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,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
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/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/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/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/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} : 提供有意义的错误信息
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} : 日志应包含时间戳、日志级别、错误代码、错误描述、堆栈跟踪(如适用)、相关上下文信息
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/development-setup.mdc:0-0
Timestamp: 2025-06-30T12:23:01.752Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Log和注释使用英文书写
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} : 始终使用 try-catch 处理可能的错误
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 **/*.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
src/main/presenter/knowledgePresenter/index.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/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/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/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
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/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/**/*.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 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/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/main/presenter/**/*.ts : Use Electron's built-in APIs for file system and native dialogs
src/shared/presenter.d.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/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/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 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/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/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 : 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/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/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/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/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.
🧬 Code Graph Analysis (1)
src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (3)
src/shared/presenter.d.ts (4)
  • IVectorDatabasePresenter (1349-1432)
  • BuiltinKnowledgeConfig (1298-1309)
  • KnowledgeFileMessage (1220-1228)
  • QueryResult (1336-1344)
src/main/presenter/index.ts (1)
  • presenter (181-181)
src/main/utils/strings.ts (1)
  • sanitizeText (1-9)
🪛 Biome (1.9.4)
src/main/presenter/knowledgePresenter/index.ts

[error] 60-61: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

⏰ 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 (1)
src/shared/presenter.d.ts (1)

313-313: Excellent type definitions for knowledge system

The type definitions are comprehensive and well-structured, providing strong type safety for the built-in knowledge system. The interfaces clearly define contracts for knowledge base operations, vector database interactions, and file management.

Key strengths:

  • Clear separation of concerns with distinct interfaces
  • Comprehensive documentation with JSDoc comments
  • Consistent naming conventions
  • Proper integration with existing presenter architecture

Also applies to: 428-435, 491-494, 542-546, 848-852, 882-890, 1211-1432

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: 3

♻️ Duplicate comments (1)
src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts (1)

78-79: Translate all remaining Chinese comments to English
Same feedback as the previous review: non-English comments violate the project’s coding guidelines.

Also applies to: 100-101, 114-115, 126-127, 141-142, 172-173, 338-338

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c514d99 and 7166690.

📒 Files selected for processing (3)
  • src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts (1 hunks)
  • src/main/presenter/knowledgePresenter/index.ts (1 hunks)
  • src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/presenter/knowledgePresenter/knowledgeStorePresenter.ts
  • src/main/presenter/knowledgePresenter/index.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{js,jsx,ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/development-setup.mdc
src/main/presenter/**/*.ts

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
{src/main/presenter/**/*.ts,src/renderer/stores/**/*.ts}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/electron-best-practices.mdc
**/*.{ts,tsx}

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/error-logging.mdc
src/main/**

Instructions used from:

Sources:
📄 CodeRabbit Inference Engine

  • .cursor/rules/project-structure.mdc
🧠 Learnings (1)
src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts (12)
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/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 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/**/*.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/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 : Use Electron's built-in APIs for file system and native dialogs
Learnt from: hllshiro
PR: ThinkInAIXYZ/deepchat#597
File: scripts/postinstall.js:10-41
Timestamp: 2025-07-15T10:15:20.427Z
Learning: DuckDB (@duckdb/node-api) automatically releases libraries and connections that are no longer referenced, so explicit connection cleanup in finally blocks is not necessary for DuckDB connections.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-06-30T12:23:01.752Z
Learning: Applies to **/*.{js,jsx,ts,tsx} : Log和注释使用英文书写
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} : 避免记录敏感信息
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} : 记录详细的错误日志
🪛 GitHub Check: build-check (x64)
src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts

[failure] 315-315:
'metadata' is declared but its value is never read.

🪛 GitHub Actions: PR Check
src/main/presenter/knowledgePresenter/database/duckdbPresenter.ts

[error] 315-315: TypeScript error TS6133: 'metadata' is declared but its value is never read.

@zerob13 zerob13 changed the base branch from dev to feature/builtin-knowledge July 16, 2025 02:55
@zerob13 zerob13 merged commit d554441 into ThinkInAIXYZ:feature/builtin-knowledge Jul 16, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jul 24, 2025
5 tasks
@hllshiro hllshiro deleted the pre-merge-feat-builtin-knowledge branch July 25, 2025 02:10
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.

3 participants