-
Notifications
You must be signed in to change notification settings - Fork 614
fix: resolve database lock issue in data reset functionality #689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: resolve database lock issue in data reset functionality #689
Conversation
WalkthroughA new "knowledge" data reset option was added across the application. The backend logic in Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SettingsUI
participant DevicePresenter
participant KnowledgeDB
User->>SettingsUI: Selects "Reset Knowledge Base Data"
SettingsUI->>DevicePresenter: Calls resetDataByType('knowledge')
DevicePresenter->>KnowledgeDB: Close connections (destroy)
DevicePresenter->>DevicePresenter: Wait 500ms
DevicePresenter->>KnowledgeDB: Delete KnowledgeBase directory
DevicePresenter-->>SettingsUI: Completion/Status
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (2)
src/renderer/src/i18n/zh-TW/settings.json (1)
79-80: Same observation as JP localeThe Traditional-Chinese strings are fine; ensure the consistency check suggested in the JP review passes.
src/renderer/src/i18n/ru-RU/settings.json (1)
79-80: Same observation as JP localeRussian translation looks good; rely on the previously provided script to confirm presence across all locales.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
src/main/presenter/devicePresenter/index.ts(3 hunks)src/renderer/src/components/settings/DataSettings.vue(2 hunks)src/renderer/src/i18n/en-US/settings.json(1 hunks)src/renderer/src/i18n/fa-IR/settings.json(1 hunks)src/renderer/src/i18n/fr-FR/settings.json(1 hunks)src/renderer/src/i18n/ja-JP/settings.json(1 hunks)src/renderer/src/i18n/ko-KR/settings.json(1 hunks)src/renderer/src/i18n/ru-RU/settings.json(1 hunks)src/renderer/src/i18n/zh-CN/settings.json(1 hunks)src/renderer/src/i18n/zh-HK/settings.json(1 hunks)src/renderer/src/i18n/zh-TW/settings.json(1 hunks)src/shared/presenter.d.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (18)
src/renderer/src/**/*
📄 CodeRabbit Inference Engine (.cursor/rules/i18n.mdc)
src/renderer/src/**/*: All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Use the 'vue-i18n' framework for all internationalization in the renderer
Ensure all user-visible text in the renderer uses the translation system
Files:
src/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/components/settings/DataSettings.vuesrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Use English for logs and comments
Files:
src/shared/presenter.d.tssrc/renderer/src/components/settings/DataSettings.vuesrc/main/presenter/devicePresenter/index.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Strict type checking enabled for TypeScript
**/*.{ts,tsx}: 始终使用 try-catch 处理可能的错误
提供有意义的错误信息
记录详细的错误日志
优雅降级处理
日志应包含时间戳、日志级别、错误代码、错误描述、堆栈跟踪(如适用)、相关上下文信息
日志级别应包括 ERROR、WARN、INFO、DEBUG
不要吞掉错误
提供用户友好的错误信息
实现错误重试机制
避免记录敏感信息
使用结构化日志
设置适当的日志级别
Files:
src/shared/presenter.d.tssrc/main/presenter/devicePresenter/index.ts
src/shared/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
Shared types in src/shared/
Files:
src/shared/presenter.d.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development-setup.mdc)
**/*.{js,jsx,ts,tsx}: 使用 OxLint 进行代码检查
Log和注释使用英文书写
Files:
src/shared/presenter.d.tssrc/main/presenter/devicePresenter/index.ts
src/shared/*.d.ts
📄 CodeRabbit Inference Engine (.cursor/rules/electron-best-practices.mdc)
The shared/*.d.ts files are used to define the types of objects exposed by the main process to the renderer process
Files:
src/shared/presenter.d.ts
src/shared/**/*.{ts,tsx,d.ts}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
共享类型定义放在
shared目录
Files:
src/shared/presenter.d.ts
src/renderer/src/**/*.vue
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/renderer/src/**/*.vue: Use Composition API for all Vue 3 components
Use Tailwind CSS with scoped styles for styling
Organize components by feature in src/renderer/src/
Follow existing component patterns in src/renderer/src/ when creating new UI components
Use Composition API with proper TypeScript typing for new UI components
Implement responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states for new UI componentsUse scoped styles to prevent CSS conflicts between components
Files:
src/renderer/src/components/settings/DataSettings.vue
src/renderer/src/**/*.{ts,tsx,vue}
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/renderer/src/**/*.{ts,tsx,vue}: Use Pinia for frontend state management
Renderer to Main: Use usePresenter.ts composable for direct presenter method calls
Files:
src/renderer/src/components/settings/DataSettings.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
渲染进程代码放在
src/renderer
Files:
src/renderer/src/components/settings/DataSettings.vue
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-best-practices.mdc)
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}: Use the Composition API for better code organization and reusability
Implement proper state management with Pinia
Utilize Vue Router for navigation and route management
Leverage Vue's built-in reactivity system for efficient data handling
Files:
src/renderer/src/components/settings/DataSettings.vue
src/renderer/**/*.{ts,tsx,vue}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
Files:
src/renderer/src/components/settings/DataSettings.vue
src/renderer/**/*.{vue,ts}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)
Implement lazy loading for routes and components.
Files:
src/renderer/src/components/settings/DataSettings.vue
src/renderer/**/*.{ts,vue}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.
Files:
src/renderer/src/components/settings/DataSettings.vue
src/main/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
Main to Renderer: Use EventBus to broadcast events via mainWindow.webContents.send()
Use Electron's built-in APIs for file system and native dialogs
Files:
src/main/presenter/devicePresenter/index.ts
src/main/presenter/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
One presenter per functional domain
Files:
src/main/presenter/devicePresenter/index.ts
src/{main,renderer}/**/*.ts
📄 CodeRabbit Inference Engine (.cursor/rules/electron-best-practices.mdc)
src/{main,renderer}/**/*.ts: Use context isolation for improved security
Implement proper inter-process communication (IPC) patterns
Optimize application startup time with lazy loading
Implement proper error handling and logging for debugging
Files:
src/main/presenter/devicePresenter/index.ts
src/main/**/*.{ts,js,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
主进程代码放在
src/main
Files:
src/main/presenter/devicePresenter/index.ts
🧠 Learnings (27)
📚 Learning: applies to src/renderer/src/i18n/common.json : shared translation keys must be placed in 'src/render...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/common.json : Shared translation keys must be placed in 'src/renderer/src/i18n/common.json'
Applied to files:
src/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : maintain consistent structure across all translation files...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : Maintain consistent structure across all translation files
Applied to files:
src/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : when adding new translations, add shared keys to 'common.j...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : When adding new translations, add shared keys to 'common.json' and language-specific keys to the respective language file; keep all language files' keys consistent
Applied to files:
src/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : regularly check for unused translation keys in i18n files...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : Regularly check for unused translation keys in i18n files
Applied to files:
src/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : language files must be located in 'src/renderer/src/i18n/'...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : Language files must be located in 'src/renderer/src/i18n/' directory
Applied to files:
src/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : each language must have a separate json file in 'src/rende...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : Each language must have a separate JSON file in 'src/renderer/src/i18n/'
Applied to files:
src/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : translation key naming must use dot-separated hierarchy, l...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
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')
Applied to files:
src/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/**/* : ensure all user-visible text in the renderer uses the translation...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/**/* : Ensure all user-visible text in the renderer uses the translation system
Applied to files:
src/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/**/* : use the 'vue-i18n' framework for all internationalization in the ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/**/* : Use the 'vue-i18n' framework for all internationalization in the renderer
Applied to files:
src/renderer/src/i18n/fr-FR/settings.json
📚 Learning: applies to src/renderer/src/**/* : all user-facing strings must use i18n keys (avoid hardcoded user-...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Applied to files:
src/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/main/presenter/configpresenter/**/*.ts : centralize configuration in configpresenter/...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/configPresenter/**/*.ts : Centralize configuration in configPresenter/
Applied to files:
src/shared/presenter.d.tssrc/main/presenter/devicePresenter/index.ts
📚 Learning: applies to src/main/presenter/**/*.ts : one presenter per functional domain...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/**/*.ts : One presenter per functional domain
Applied to files:
src/shared/presenter.d.tssrc/main/presenter/devicePresenter/index.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/providers/*.ts : provider files should implement ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should implement helper methods such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed for provider-specific logic.
Applied to files:
src/shared/presenter.d.tssrc/main/presenter/devicePresenter/index.ts
📚 Learning: applies to src/renderer/src/**/*.{ts,tsx,vue} : renderer to main: use usepresenter.ts composable for...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.{ts,tsx,vue} : Renderer to Main: Use usePresenter.ts composable for direct presenter method calls
Applied to files:
src/shared/presenter.d.tssrc/main/presenter/devicePresenter/index.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/index.ts : `src/main/presenter/llmproviderpresent...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : `src/main/presenter/llmProviderPresenter/index.ts` should manage the overall Agent loop, conversation history, tool execution via `McpPresenter`, and frontend communication via `eventBus`.
Applied to files:
src/shared/presenter.d.tssrc/main/presenter/devicePresenter/index.ts
📚 Learning: applies to src/renderer/src/composables/usepresenter.ts : the ipc in the renderer process is impleme...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:45:54.229Z
Learning: Applies to src/renderer/src/composables/usePresenter.ts : The IPC in the renderer process is implemented in usePresenter.ts, allowing direct calls to the presenter-related interfaces exposed by the main process
Applied to files:
src/shared/presenter.d.ts
📚 Learning: applies to src/main/presenter/mcppresenter/index.ts : register new mcp tool in mcppresenter/index.ts...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Applied to files:
src/shared/presenter.d.tssrc/main/presenter/devicePresenter/index.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/providers/*.ts : all provider implementations mus...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : All provider implementations must parse provider-specific data chunks and yield standardized events for text, reasoning, tool calls, usage, errors, stop reasons, and image data.
Applied to files:
src/shared/presenter.d.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/providers/*.ts : provider implementations should ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider implementations should yield text events in the standardized format.
Applied to files:
src/shared/presenter.d.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/streamevents.ts : standardized stream events shou...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/streamEvents.ts : Standardized stream events should conform to the `LLMCoreStreamEvent` interface, ideally defined in a shared file such as `src/main/presenter/llmProviderPresenter/streamEvents.ts`.
Applied to files:
src/shared/presenter.d.ts
📚 Learning: applies to src/main/**/*.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-07-21T01:45:54.229Z
Learning: Applies to src/main/**/*.ts : Use Electron's built-in APIs for file system and native dialogs
Applied to files:
src/shared/presenter.d.ts
📚 Learning: applies to src/shared/**/*.{ts,tsx,d.ts} : 共享类型定义放在 `shared` 目录...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-07-21T01:47:11.608Z
Learning: Applies to src/shared/**/*.{ts,tsx,d.ts} : 共享类型定义放在 `shared` 目录
Applied to files:
src/shared/presenter.d.tssrc/renderer/src/components/settings/DataSettings.vuesrc/main/presenter/devicePresenter/index.ts
📚 Learning: applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : implement proper state persistence for...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.479Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions
Applied to files:
src/renderer/src/components/settings/DataSettings.vue
📚 Learning: applies to src/renderer/src/**/*.vue : use composition api with proper typescript typing for new ui ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.vue : Use Composition API with proper TypeScript typing for new UI components
Applied to files:
src/renderer/src/components/settings/DataSettings.vue
📚 Learning: applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : leverage vue's built-in reactivity system for...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:28.817Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Leverage Vue's built-in reactivity system for efficient data handling
Applied to files:
src/renderer/src/components/settings/DataSettings.vue
📚 Learning: applies to src/renderer/**/*.{vue} : leverage ref, reactive, and computed for reactive state managem...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Leverage ref, reactive, and computed for reactive state management.
Applied to files:
src/renderer/src/components/settings/DataSettings.vue
📚 Learning: applies to src/main/presenter/mcppresenter/inmemoryservers/*.ts : implement new mcp tool in src/main...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Applied to files:
src/main/presenter/devicePresenter/index.ts
🔇 Additional comments (13)
src/renderer/src/i18n/zh-CN/settings.json (1)
79-80: Keys added consistently – run the same completeness check.Implementation mirrors the HK variant and remains JSON-valid.
Run the repo-wide search suggested above to ensure every language file includes these keys so translators aren’t surprised later.src/renderer/src/i18n/en-US/settings.json (1)
79-80: English wording OK – remember to wire it in the UI.Label/description read naturally and match tense/style of existing reset options.
Again, make sure the component displays this via$t()and that no hard-coded fallback string slipped into the template when adding the new option.src/renderer/src/i18n/fr-FR/settings.json (1)
79-80: French translation added – verify consistency & accents.The phrasing is idiomatic; minor note: « réinitialiser les données de la base de connaissances » would also work but current version is fine.
Please run the same global-key presence audit to avoid missing locales.src/renderer/src/i18n/ja-JP/settings.json (1)
79-80: Locale coverage verified for knowledge-reset keysThe verification script confirms that both
resetKnowledgeDataandresetKnowledgeDataDescare present in everysettings.jsonundersrc/renderer/src/i18n. No further action is needed—approving these changes.src/shared/presenter.d.ts (1)
740-740: LGTM! Type definition correctly extended for knowledge data reset.The addition of
'knowledge'to the union type forresetDataByTypemethod properly supports the new knowledge base data reset functionality while maintaining type safety and backward compatibility.src/renderer/src/i18n/ko-KR/settings.json (1)
79-80: Korean localization correctly added for knowledge data reset.The new translation keys
resetKnowledgeDataandresetKnowledgeDataDescare properly structured and provide appropriate Korean translations for the knowledge base data reset functionality. The translations follow the existing naming conventions and file structure.src/renderer/src/i18n/fa-IR/settings.json (1)
79-80: Persian localization correctly added for knowledge data reset.The new translation keys
resetKnowledgeDataandresetKnowledgeDataDescare properly structured and provide appropriate Persian translations for the knowledge base data reset functionality. The translations follow the existing naming conventions and maintain consistent structure across all translation files.src/renderer/src/components/settings/DataSettings.vue (2)
156-169: LGTM! Well-integrated knowledge reset UI option.The new knowledge reset option follows existing UI patterns perfectly and integrates cleanly into the radio group. The implementation uses proper i18n keys and maintains consistent styling with Tailwind CSS.
283-283: LGTM! Proper TypeScript type extension.The type definition correctly includes the new 'knowledge' option while maintaining type safety with string literal unions.
src/main/presenter/devicePresenter/index.ts (4)
284-286: LGTM! Method signature properly updated.The method signature and JSDoc correctly reflect the new 'knowledge' reset type, maintaining consistency with the interface definition.
316-323: Excellent! Database lock issue properly resolved.The implementation correctly addresses the database lock issue by:
- Closing database connections before file operations
- Adding appropriate delays for cleanup
- Using separate error handling for connection management
- Handling both SQLite and knowledge database connections
This resolves the core issue mentioned in the PR objectives.
Also applies to: 350-358, 396-408
347-362: LGTM! Well-implemented knowledge database reset.The knowledge reset implementation follows best practices:
- Proper resource cleanup via
knowledgePresenter.destroy()- Specific targeting of the KnowledgeBase directory
- Consistent error handling and logging patterns
- Appropriate cleanup delays
The implementation integrates seamlessly with existing reset functionality.
314-344: LGTM! Robust error handling and logging.The error handling strategy is excellent:
- Comprehensive logging for debugging
- Graceful handling of connection closing failures
- Appropriate log levels (log/warn/error)
- Non-critical errors don't block reset operations
- Detailed contextual error messages
This ensures the reset functionality is both resilient and debuggable.
Also applies to: 349-361, 395-411
| "resetKnowledgeData": "重置知識庫數據", | ||
| "resetKnowledgeDataDesc": "刪除所有知識庫檔案和向量數據", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
New keys look good – confirm cross-language coverage.
resetKnowledgeData / resetKnowledgeDataDesc follow the existing naming pattern and slot into the "data" block correctly.
Please double-check that:
- The same two keys exist in all other language JSONs (including those not in this PR, e.g. de-DE, es-ES if they exist).
- The settings UI (
DataSettings.vue) already references these keys via$t('data.resetKnowledgeData')/$t('data.resetKnowledgeDataDesc').
Quick grep to verify other languages:
If any file is missing, add stubs soon to keep the structure consistent.
🏁 Script executed:
rg -l '"resetKnowledgeData"' src/renderer/src/i18nLength of output: 430
🏁 Script executed:
#!/bin/bash
echo "Checking presence of resetKnowledgeDataDesc in i18n JSON files:"
rg -l '"resetKnowledgeDataDesc"' src/renderer/src/i18n
echo
echo "Locating DataSettings.vue:"
fd DataSettings.vue
DATA_SETTINGS_FILE=$(fd DataSettings.vue | head -n 1)
echo
echo "Verifying translation key usages in $DATA_SETTINGS_FILE:"
rg -n "\$t\('data.resetKnowledgeData'\)" "$DATA_SETTINGS_FILE"
rg -n "\$t\('data.resetKnowledgeDataDesc'\)" "$DATA_SETTINGS_FILE"Length of output: 1236
Missing translation usage in DataSettings.vue
All language JSONs under src/renderer/src/i18n/*/settings.json include the new keys (resetKnowledgeData, resetKnowledgeDataDesc), but the settings UI does not reference them.
Please update src/renderer/src/components/settings/DataSettings.vue to use:
$t('data.resetKnowledgeData')$t('data.resetKnowledgeDataDesc')
so the new translations actually appear in the UI.
🤖 Prompt for AI Agents
In src/renderer/src/components/settings/DataSettings.vue, update the UI code to
reference the new translation keys by replacing or adding text bindings with
$t('data.resetKnowledgeData') and $t('data.resetKnowledgeDataDesc'). This will
ensure the new translations from the JSON files are displayed in the settings
interface.
* fix: prevent tooltip from overlapping HTML preview in ArtifactDialog (#683) * fix: unwatch is not a function error in knowledge settings components (#684) * fix: resolve message editing and markdown rendering issues (#685) * docs: update Electron-Vite link format to full URL (#687) * fix: built-in knowledge settings not loaded when first entering (#688) * fix: enhance lifecycle management by adding unmounted hook and MCP state watcher * fix: improve knowledge destruction confirmation and enhance unwatch handling in settings * fix: resolve database lock issue in data reset functionality (#689) * feat: implement provider-based request rate limit (#686) * feat: implement provider-based request rate limit * feat: add input validation with confirmation dialog * refactor: merge RateLimitPresenter into LLMProviderPresenter * Optimize/builtin knowledge interaction (#690) * feat: improve builtInKnowledge file icon style * feat: add builtInKnowledge resume icon tooltip * feat: format code * Update src/renderer/src/i18n/fa-IR/settings.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update src/renderer/src/i18n/ja-JP/settings.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update src/renderer/src/i18n/fr-FR/settings.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update settings.json * Update src/renderer/src/i18n/fr-FR/settings.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: Fix French and Korean translations for pause and delete file confirmation messages --------- Co-authored-by: sqsyli <sqsyli@qq.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: fixed dirty data problems (#691) fixed the old session tool error caused by fixed the problem that the tool list was not reset when creating a new session * feat: add mentions support in deeplink (#692) * feat: add mentions support in chat input and store * style: format imports and clean up code for better readability * fix: improve mentions handling in handleStart method * fix: prompt attach files (#695) * fix: update file icon handling and improve file upload process * fix: remove redundant FileItem interface definition in PromptSetting.vue * fix: implement confirmation dialog for prompt deletion in PromptSetting.vue * fix: streamline file upload process by removing redundant file content reading logic * feat: add npm registry caching and optimization system (#697) * fix: resolve input focus loss issue after sending messages (#694) * fix: resolve deeplink message not displaying when triggered from settings page (#699) * fix: update current tools assignment to include tool names when MCP tools are not enabled (#698) * feat: add support for new models (#700) * chore: update ollama model settings * chore: add support for gpt-oss * chore: bump to 0.2.9 * fix: refine #698 (#701) * fix: update current tools assignment to include tool names when MCP tools are not enabled * fix: update enabled MCP tools assignment to include tool names on session switch * feat: add Claude Opus 4.1 support and fix anthropic model list dialog (#702) --------- Co-authored-by: yyhhyyyyyy <yyhhyyyyyy8@gmail.com> Co-authored-by: cycleccc <2991205548@qq.com> Co-authored-by: hllshiro <40970081+hllshiro@users.noreply.github.com> Co-authored-by: sqsyli <sqsyli@qq.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
resolve database lock issue in data reset functionality
add reset knowledge db
Summary by CodeRabbit
New Features
Localization