-
Notifications
You must be signed in to change notification settings - Fork 614
feat: Add thinking budget support for Gemini 2.5 series models #643
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
feat: Add thinking budget support for Gemini 2.5 series models #643
Conversation
WalkthroughThis update introduces a "thinking budget" configuration for Gemini 2.5 series models. It adds backend support for handling the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ModelConfigDialog (UI)
participant GeminiProvider (Backend)
participant ModelConfig (Shared)
User->>ModelConfigDialog (UI): Opens model config dialog
ModelConfigDialog (UI)->>ModelConfigDialog (UI): Checks if Gemini 2.5 model & reasoning enabled
ModelConfigDialog (UI)->>User: Shows thinking budget controls
User->>ModelConfigDialog (UI): Sets thinking budget value
ModelConfigDialog (UI)->>ModelConfig (Shared): Updates ModelConfig with thinkingBudget
ModelConfigDialog (UI)->>GeminiProvider (Backend): Submits config with thinkingBudget
GeminiProvider (Backend)->>GeminiProvider (Backend): Validates model supports thinkingBudget
GeminiProvider (Backend)->>GeminiProvider (Backend): Applies thinkingBudget in generation config
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
✨ 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. 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)
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: 2
🔭 Outside diff range comments (2)
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts (1)
1-1255: Fix Prettier formatting issues before merging.The pipeline check indicates Prettier formatting violations that need to be resolved.
Please run the following command to fix the formatting issues:
prettier --write src/main/presenter/llmProviderPresenter/providers/geminiProvider.tsThis will ensure the code meets the project's formatting standards before merging.
src/renderer/src/components/settings/ModelConfigDialog.vue (1)
1-1: Fix Prettier formatting issues.The pipeline check indicates formatting issues. Please run
prettier --writeto fix code style issues before merging.
♻️ Duplicate comments (1)
src/renderer/src/i18n/en-US/settings.json (1)
123-149: Same coverage check as above
Please run the same verification script to keep the i18n structure consistent across languages.
🧹 Nitpick comments (3)
src/shared/presenter.d.ts (1)
120-131: DocumentthinkingBudget& wire a default
Great to see the new field, but it currently lacks any description. Add a concise JSDoc such as/** * Thinking-budget in tokens. * 0 → disable reasoning, * –1 → dynamic, * >0 → explicit token budget */and ensure
configPresenter.getModelDefaultConfig()(and any migration logic) returns an explicit default so downstream code can rely on a defined value.src/renderer/src/components/settings/ModelConfigDialog.vue (2)
445-445: Remove unnecessary empty lines.There are extra empty lines that should be removed for cleaner code.
- - // 思考预算验证错误- - // 处理动态思维开关- - onMounted(() => {Also applies to: 489-489, 512-512
396-426: Consider using a configuration map for better maintainability.The current string-based model detection works but could be more maintainable with a configuration map approach.
For future improvements, consider refactoring to use a configuration map:
const THINKING_BUDGET_CONFIGS: Record<string, ThinkingBudgetConfig> = { 'gemini-2.5-pro': { min: 128, max: 32768, defaultValue: -1, canDisable: false }, 'gemini-2.5-flash-lite': { min: 0, max: 24576, defaultValue: 0, canDisable: true }, 'gemini-2.5-flash': { min: 0, max: 24576, defaultValue: -1, canDisable: true } }This would make it easier to add new models and maintain the configurations in one place.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts(3 hunks)src/renderer/src/components/message/MessageItemAssistant.vue(2 hunks)src/renderer/src/components/settings/ModelConfigDialog.vue(5 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 (19)
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-CN/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/components/message/MessageItemAssistant.vuesrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/components/settings/ModelConfigDialog.vuesrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/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/message/MessageItemAssistant.vuesrc/main/presenter/llmProviderPresenter/providers/geminiProvider.tssrc/renderer/src/components/settings/ModelConfigDialog.vue
**/*.{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/llmProviderPresenter/providers/geminiProvider.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/llmProviderPresenter/providers/geminiProvider.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/message/MessageItemAssistant.vuesrc/renderer/src/components/settings/ModelConfigDialog.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/message/MessageItemAssistant.vuesrc/renderer/src/components/settings/ModelConfigDialog.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
渲染进程代码放在
src/renderer
Files:
src/renderer/src/components/message/MessageItemAssistant.vuesrc/renderer/src/components/settings/ModelConfigDialog.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/message/MessageItemAssistant.vuesrc/renderer/src/components/settings/ModelConfigDialog.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/message/MessageItemAssistant.vuesrc/renderer/src/components/settings/ModelConfigDialog.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/message/MessageItemAssistant.vuesrc/renderer/src/components/settings/ModelConfigDialog.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/message/MessageItemAssistant.vuesrc/renderer/src/components/settings/ModelConfigDialog.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/llmProviderPresenter/providers/geminiProvider.ts
src/main/presenter/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
One presenter per functional domain
Files:
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
src/main/presenter/llmProviderPresenter/providers/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/main/presenter/llmProviderPresenter/providers/*.ts: Create provider file in src/main/presenter/llmProviderPresenter/providers/ when adding a new LLM provider
Implement coreStream method following standardized event interface in LLM provider files
src/main/presenter/llmProviderPresenter/providers/*.ts: Each file insrc/main/presenter/llmProviderPresenter/providers/*.tsshould handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, native/non-native tool call management, and standardizing output streams to a common event format.
Provider implementations must use acoreStreammethod that yields standardized stream events to decouple the main loop from provider-specific details.
ThecoreStreammethod in each Provider must perform a single streaming API request per conversation round and must not contain multi-round tool call loop logic.
Provider files should implement helper methods such asformatMessages,convertToProviderTools,parseFunctionCalls, andprepareFunctionCallPromptas needed for provider-specific logic.
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.
When a provider does not support native function calling, it must prepare messages using prompt wrapping (e.g.,prepareFunctionCallPrompt) before making the API call.
When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., usingconvertToProviderTools) and included in the API request.
Provider implementations should aggregate and yield usage events as part of the standardized stream.
Provider implementations should yield image data events in the standardized format when applicable.
Provider implementations should yield reasoning events in the standardized format when applicable.
Provider implementations should yield tool call events (`tool_call_star...
Files:
src/main/presenter/llmProviderPresenter/providers/geminiProvider.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/llmProviderPresenter/providers/geminiProvider.ts
src/main/**/*.{ts,js,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
主进程代码放在
src/main
Files:
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
🧠 Learnings (13)
src/renderer/src/i18n/fr-FR/settings.json (10)
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'
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
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
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
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/'
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
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')
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)
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
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
src/shared/presenter.d.ts (2)
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/
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/providers.ts : Add provider configuration in configPresenter/providers.ts when adding a new LLM provider
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-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'
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
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
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
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/'
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)
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
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-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'
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
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
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
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-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'
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
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
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
src/renderer/src/i18n/ko-KR/settings.json (9)
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'
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
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
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/'
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
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)
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
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')
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
src/renderer/src/components/message/MessageItemAssistant.vue (8)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.vue : Add proper error handling and loading states for new UI components
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use Suspense for asynchronous components.
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.
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{ts,tsx,vue} : Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use Iconify/Vue for icon implementation.
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
Learnt from: neoragex2002
PR: #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.
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
src/renderer/src/i18n/ja-JP/settings.json (7)
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
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'
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
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)
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/'
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
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
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts (8)
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/providers.ts : Add provider configuration in configPresenter/providers.ts when adding a new LLM provider
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 reasoning events in the standardized format when applicable.
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.
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 : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using convertToProviderTools) and included in the API request.
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.
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/llmProviderPresenter/providers/*.ts : Implement coreStream method following standardized event interface in LLM provider files
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 : Each file in src/main/presenter/llmProviderPresenter/providers/*.ts should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, native/non-native tool call management, and standardizing output streams to a common event format.
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/llmProviderPresenter/providers/*.ts : Create provider file in src/main/presenter/llmProviderPresenter/providers/ when adding a new LLM provider
src/renderer/src/components/settings/ModelConfigDialog.vue (1)
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/
src/renderer/src/i18n/ru-RU/settings.json (8)
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'
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
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
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')
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
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)
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
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/'
src/renderer/src/i18n/zh-HK/settings.json (3)
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'
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
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
src/renderer/src/i18n/zh-TW/settings.json (6)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-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'
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
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
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
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)
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/'
🪛 GitHub Actions: PR Check
src/renderer/src/components/message/MessageItemAssistant.vue
[warning] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues.
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
[warning] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues.
src/renderer/src/components/settings/ModelConfigDialog.vue
[warning] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues.
🔇 Additional comments (14)
src/renderer/src/i18n/fr-FR/settings.json (1)
123-149: Verification complete: allsettings.jsoncontain thethinkingBudgetkeys
The detection script ran against every locale insrc/renderer/src/i18n/*/settings.jsonand found no missing entries. No further changes are needed.src/renderer/src/i18n/ja-JP/settings.json (1)
123-149: Excellent comprehensive localization for thinking budget feature.The Japanese translations are well-structured and comprehensive, covering all aspects of the thinking budget configuration including model-specific warnings, usage hints, and validation messages. The key naming follows established conventions and the translations appear technically accurate.
src/renderer/src/i18n/ko-KR/settings.json (1)
123-149: Consistent and comprehensive Korean localization.The Korean translations maintain perfect structural consistency with other language files while providing comprehensive coverage of the thinking budget feature. All model-specific warnings, usage hints, and validation messages are properly translated.
src/renderer/src/i18n/zh-CN/settings.json (1)
131-157: Well-structured Chinese localization with comprehensive coverage.The Chinese (Simplified) translations maintain consistency with other language files and provide comprehensive coverage of the thinking budget feature. Technical terminology is appropriate and all functional aspects are properly localized.
src/renderer/src/i18n/fa-IR/settings.json (1)
123-149: Comprehensive Persian localization maintaining cross-language consistency.The Persian translations provide complete coverage of the thinking budget feature with appropriate technical terminology. The structural consistency across all language files ensures maintainable internationalization.
src/renderer/src/components/message/MessageItemAssistant.vue (1)
21-21: Template condition correctly updated for thinking budget integration.The condition now properly checks both empty content and the new
shouldShowThinkingflag, enabling dynamic control of the thinking indicator based on model configuration.src/renderer/src/i18n/zh-TW/settings.json (1)
123-149: Excellent localization implementation for thinking budget feature.The Traditional Chinese translations are comprehensive and well-structured, covering all aspects of the thinking budget configuration including:
- Clear labels and descriptions
- Model-specific constraints and warnings
- User-friendly hints for valid input values
- Proper handling of special values (-1 for dynamic thinking, 0 for disable)
The translations maintain consistency with existing terminology and provide clear guidance for users.
src/renderer/src/i18n/zh-HK/settings.json (1)
123-149: Well-executed Hong Kong Chinese localization.The translations are comprehensive and appropriately adapted for Hong Kong Chinese users. The structure is consistent with other language files and covers all necessary aspects of the thinking budget feature including model constraints, warnings, and user guidance.
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts (3)
440-447: Clean implementation of thinking budget model detection.The
supportsThinkingBudgetmethod correctly identifies Gemini 2.5 series models that support the thinking budget parameter. The implementation is straightforward and matches the model constraints described in the UI translations.
450-483: Proper integration of thinking budget in generation configuration.The modification to
getGenerationConfigcorrectly handles the thinking budget parameter:
- Only applies to supported models via the
supportsThinkingBudgetcheck- Properly integrates with the existing
thinkingConfigstructure- Maintains backward compatibility with existing code
The implementation follows the established patterns and integrates well with the reasoning functionality.
955-955: Correct parameter passing to generation configuration.The
coreStreammethod properly passes thethinkingBudgetfrom the model configuration to thegetGenerationConfigmethod, completing the integration of the thinking budget feature.src/renderer/src/i18n/ru-RU/settings.json (1)
123-149: LGTM! Translation structure follows i18n guidelines.The new "thinkingBudget" section is well-structured with comprehensive Russian translations for all UI elements including labels, descriptions, warnings, and hints. The keys follow the required dot-separated hierarchy pattern.
src/renderer/src/components/settings/ModelConfigDialog.vue (2)
136-187: Well-implemented thinking budget UI section.The conditional UI for thinking budget configuration properly uses:
- i18n for all user-visible text
- Tailwind CSS for styling
- Proper form validation with visual feedback
- Correct v-model bindings and event handlers
352-352: Validation logic correctly extended.The form validation properly includes the thinking budget error check alongside existing validations.
| // 判断是否应该显示"正在思考..." | ||
| const shouldShowThinking = ref(true) | ||
| // 监听消息变化,更新思考状态显示逻辑 | ||
| watch( | ||
| () => [currentMessage.value.model_id, currentMessage.value.model_provider, currentMessage.value.status], | ||
| async () => { | ||
| if (currentMessage.value.status !== 'pending') { | ||
| shouldShowThinking.value = false | ||
| return | ||
| } | ||
| try { | ||
| const modelConfig = await settingsStore.getModelConfig( | ||
| currentMessage.value.model_id, | ||
| currentMessage.value.model_provider | ||
| ) | ||
| if (modelConfig.thinkingBudget !== undefined) { | ||
| shouldShowThinking.value = modelConfig.thinkingBudget !== 0 | ||
| } else { | ||
| shouldShowThinking.value = modelConfig.reasoning | ||
| } | ||
| } catch (error) { | ||
| shouldShowThinking.value = true | ||
| } | ||
| }, | ||
| { immediate: true } | ||
| ) |
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.
🛠️ Refactor suggestion
Implement race condition protection and fix formatting.
The thinking indicator logic is well-structured but needs improvements:
- Race condition risk: Multiple async calls could complete out of order
- Formatting issues: Pipeline indicates Prettier formatting problems
Apply this diff to add race condition protection:
+let currentConfigFetch = 0
+
// 监听消息变化,更新思考状态显示逻辑
watch(
() => [currentMessage.value.model_id, currentMessage.value.model_provider, currentMessage.value.status],
async () => {
+ const fetchId = ++currentConfigFetch
+
if (currentMessage.value.status !== 'pending') {
shouldShowThinking.value = false
return
}
try {
const modelConfig = await settingsStore.getModelConfig(
currentMessage.value.model_id,
currentMessage.value.model_provider
)
+ // Ignore if this is not the latest fetch
+ if (fetchId !== currentConfigFetch) return
+
if (modelConfig.thinkingBudget !== undefined) {
shouldShowThinking.value = modelConfig.thinkingBudget !== 0
} else {
shouldShowThinking.value = modelConfig.reasoning
}
} catch (error) {
+ if (fetchId !== currentConfigFetch) return
shouldShowThinking.value = true
}
},
{ immediate: true }
)Also run prettier --write to fix formatting issues.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // 判断是否应该显示"正在思考..." | |
| const shouldShowThinking = ref(true) | |
| // 监听消息变化,更新思考状态显示逻辑 | |
| watch( | |
| () => [currentMessage.value.model_id, currentMessage.value.model_provider, currentMessage.value.status], | |
| async () => { | |
| if (currentMessage.value.status !== 'pending') { | |
| shouldShowThinking.value = false | |
| return | |
| } | |
| try { | |
| const modelConfig = await settingsStore.getModelConfig( | |
| currentMessage.value.model_id, | |
| currentMessage.value.model_provider | |
| ) | |
| if (modelConfig.thinkingBudget !== undefined) { | |
| shouldShowThinking.value = modelConfig.thinkingBudget !== 0 | |
| } else { | |
| shouldShowThinking.value = modelConfig.reasoning | |
| } | |
| } catch (error) { | |
| shouldShowThinking.value = true | |
| } | |
| }, | |
| { immediate: true } | |
| ) | |
| let currentConfigFetch = 0 | |
| // 判断是否应该显示"正在思考..." | |
| const shouldShowThinking = ref(true) | |
| // 监听消息变化,更新思考状态显示逻辑 | |
| watch( | |
| () => [ | |
| currentMessage.value.model_id, | |
| currentMessage.value.model_provider, | |
| currentMessage.value.status | |
| ], | |
| async () => { | |
| const fetchId = ++currentConfigFetch | |
| if (currentMessage.value.status !== 'pending') { | |
| shouldShowThinking.value = false | |
| return | |
| } | |
| try { | |
| const modelConfig = await settingsStore.getModelConfig( | |
| currentMessage.value.model_id, | |
| currentMessage.value.model_provider | |
| ) | |
| // Ignore if this is not the latest fetch | |
| if (fetchId !== currentConfigFetch) return | |
| if (modelConfig.thinkingBudget !== undefined) { | |
| shouldShowThinking.value = modelConfig.thinkingBudget !== 0 | |
| } else { | |
| shouldShowThinking.value = modelConfig.reasoning | |
| } | |
| } catch (error) { | |
| // Ignore stale errors | |
| if (fetchId !== currentConfigFetch) return | |
| shouldShowThinking.value = true | |
| } | |
| }, | |
| { immediate: true } | |
| ) |
🤖 Prompt for AI Agents
In src/renderer/src/components/message/MessageItemAssistant.vue around lines 227
to 255, the async watch callback for updating shouldShowThinking can cause race
conditions if multiple calls overlap; fix this by introducing a local version
token to ensure only the latest async result updates shouldShowThinking. Also,
run Prettier on this section to correct formatting issues as indicated by the
pipeline.
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 (1)
src/renderer/src/components/settings/ModelConfigDialog.vue (1)
302-307: Eliminate code duplication in thinking budget initialization.This duplicates the exact issue identified in previous reviews. The thinking budget initialization logic appears in both try and catch blocks, violating the DRY principle.
Extract the initialization logic as suggested in the previous review:
const loadConfig = async () => { if (!props.modelId || !props.providerId) return try { const modelConfig = await settingsStore.getModelConfig(props.modelId, props.providerId) config.value = { ...modelConfig } - - if (props.providerId === 'gemini') { - const modelConfig = getThinkingBudgetConfig(props.modelId) - if (modelConfig && config.value.thinkingBudget === undefined) { - config.value.thinkingBudget = modelConfig.defaultValue - } - } } catch (error) { console.error('Failed to load model config:', error) const defaultConfig: ModelConfig = { maxTokens: 4096, contextLength: 8192, temperature: 0.7, vision: false, functionCall: false, reasoning: false, type: ModelType.Chat } - - if (props.providerId === 'gemini') { - const modelConfig = getThinkingBudgetConfig(props.modelId) - if (modelConfig) { - defaultConfig.thinkingBudget = modelConfig.defaultValue - } - } - config.value = defaultConfig } + + // Initialize thinking budget if not set + if (props.providerId === 'gemini' && config.value.thinkingBudget === undefined) { + const thinkingConfig = getThinkingBudgetConfig(props.modelId) + if (thinkingConfig) { + config.value.thinkingBudget = thinkingConfig.defaultValue + } + } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts(3 hunks)src/renderer/src/components/message/MessageItemAssistant.vue(2 hunks)src/renderer/src/components/settings/ModelConfigDialog.vue(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/components/message/MessageItemAssistant.vue
- src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Use English for logs and comments
Files:
src/renderer/src/components/settings/ModelConfigDialog.vue
src/renderer/src/**/*.vue
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/renderer/src/**/*.vue: Use Composition API for all Vue 3 components
Use Tailwind CSS with scoped styles for styling
Organize components by feature in src/renderer/src/
Follow existing component patterns in src/renderer/src/ when creating new UI components
Use Composition API with proper TypeScript typing for new UI components
Implement responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states for new UI componentsUse scoped styles to prevent CSS conflicts between components
Files:
src/renderer/src/components/settings/ModelConfigDialog.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/ModelConfigDialog.vue
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/components/settings/ModelConfigDialog.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
渲染进程代码放在
src/renderer
Files:
src/renderer/src/components/settings/ModelConfigDialog.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/ModelConfigDialog.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/ModelConfigDialog.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/ModelConfigDialog.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/ModelConfigDialog.vue
🧠 Learnings (1)
src/renderer/src/components/settings/ModelConfigDialog.vue (2)
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: The Agent loop logic should be centralized in index.ts to reduce code duplication and improve maintainability.
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/
🪛 GitHub Check: build-check (x64)
src/renderer/src/components/settings/ModelConfigDialog.vue
[failure] 494-494:
'value' is possibly 'undefined'.
[failure] 477-477:
'value' is possibly 'undefined'.
[failure] 477-477:
'value' is possibly 'undefined'.
[failure] 475-475:
'value' is possibly 'undefined'.
🪛 GitHub Actions: PR Check
src/renderer/src/components/settings/ModelConfigDialog.vue
[error] 475-475: TypeScript error TS18048: 'value' is possibly 'undefined'.
🔇 Additional comments (4)
src/renderer/src/components/settings/ModelConfigDialog.vue (4)
136-196: Well-structured thinking budget UI implementation.The template changes follow Vue 3 Composition API patterns correctly and maintain consistency with existing form sections. All user-facing text properly uses i18n keys as required by the coding guidelines, and the conditional rendering logic is appropriate.
361-361: Correct integration of thinking budget validation.The addition properly extends the existing validation logic to include thinking budget errors in the overall form validity check.
405-453: Well-structured model configuration helper functions.The
getThinkingBudgetConfigfunction and related computed properties properly handle different Gemini model variants with appropriate constraints and follow Vue 3 Composition API best practices.
500-521: Clean implementation of thinking budget controls.The toggle handler and hint functions provide appropriate user interaction logic and contextual help text, maintaining consistency with the component's patterns.
* (WIP) feat: add Builtin Knowledge Server and settings integration * feat: add multiple languages translation * feat: enhance BuiltinKnowledgeSettings with model selection and update translations * feat: update BuiltinKnowledgeSettings with enhanced configuration options and translations * feat: update knowledge base settings to use 'builtinKnowledge' and enhance BuiltinKnowledgeSettings with URL query parameter handling * feat: enhance BuiltinKnowledgeSettings with model selection and error handling for missing models * feat: add confirmation dialog and error messages for removing built-in knowledge configurations * props * [WIP] feat: implement KnowledgePresenter and related embedding functionality * [WIP] feat: add KnowledgeConfHelper for managing knowledge base configurations * [WIP] feat: log new knowledge config additions in KnowledgePresenter * [WIP] feat: enhance knowledge base settings and descriptions across components * [WIP] feat: enhance Built-in Knowledge settings and descriptions, add advanced options and tooltips * [WIP] feat: add dimensionsHelper to settings for better user guidance on embedding dimensions * [WIP] feat: add getDimensions method and update embedding handling across providers * [wip] feat: enhance embedding handling by adding error handling and resetting model selection in settings * [WIP] feat: refactor embedding handling to use modelId and providerId, enhance KnowledgePresenter integration * [WIP] feat: update KnowledgePresenter and LLMProviderPresenter to improve embedding handling and error logging * [WIP] feat: enhance BuiltinKnowledgeSettings with additional parameters and loading logic for better user experience * [WIP] feat: enhance KnowledgePresenter to handle deleted configs and improve reset logic * [WIP] feat: update LLMProviderPresenter and OllamaProvider to enhance model listing with additional configuration properties * [WIP] feat: enhance Ollama model integration by updating local models to include dynamic configuration retrieval * [WIP] fix: update getRagApplication to include baseURL in Embeddings instantiation * [WIP] feat: update getDimensions method to return structured response with error handling * [WIP] feat: enhance BuiltinKnowledgeSettings with dynamic dimension detection and loading state * feat: add duration to toast notifications for improved user feedback * feat: add BuiltinKnowledge file upload box * feat: update TODO list with additional parameters and logic improvements for BuiltinKnowledgeSettings and OllamaProvider * feat: add delay duration to tooltips for improved user experience * feat: add BuiltinKnowledge file reload button * feat: limit BuiltinKnowledge file types * feat: add new BuiltinKnowledge form items * fix: fix BuiltInKnowledge embedding modelId * 还原lucide-vue-next版本提升的修改 * fix: fix BuiltInKnowledge rerank form item * [WIP] refactor: update knowledge base configuration to use BuiltinKnowledgeConfig and remove unused embedding classes (duckdb does not provide an binrary extension for windows) * chore: remove unused llm-tools embedjs dependencies from package.json * feat: implement DuckDBPresenter for vector database operations (make sure duckdb extension vss has been installed) * refactor: update import statements to use default imports for fs and path * feat: add BuiltinKnowledge form Information display * refactor: restructure postinstall script for clarity and improved extension installation process * refactor: update icon in BuiltinKnowledgeSettings and change v-show to v-if in KnowledgeBaseSettings; add file type acceptance in KnowledgeFile * refactor: simplify file icon retrieval by centralizing logic in getMimeTypeIcon utility function * refactor: enhance type safety for builtinKnowledgeDetail and improve code readability in KnowledgeBaseSettings and KnowledgeFile components * fix: add optional chaining for builtinKnowledgeDetail description to prevent potential runtime errors * feat: add KnowledgeFileMessage type and file management methods to IKnowledgePresenter interface * feat: enhance DuckDBPresenter with file management methods and update IVectorDatabasePresenter interface * refactor: rename methods and update table names in DuckDBPresenter for clarity and consistency * feat: implement file management methods in RagPresenter and update IKnowledgePresenter interface * feat: access BuiltinKnowledge file interface * fix: fix prompt information error * fix: improve error toast description for file upload failure * feat: add file management methods and enhance interfaces in presenters; update file handling logic * feat: add RAG_EVENTS for file update notifications; implement vector utility functions * feat: enhance LLM dimension handling and add normalization support; update related components and translations * feat: update vector database handling to include normalization support; refactor related methods * feat: add dayjs dependency for time formatting * feat: add a listener for FILE_UPDATED * feat: change the params format * feat: change callback function * fix: resolve merge conflicts in localization files * feat(knowledge): Implement file listing and fix embedding parameters * feat: change loadlist after file upload and file delete * fix(knowledge): correct timestamp storage and refactor database interaction * fix: remove unnecessary nextTick in reAddFile * fix: remove duplicate loadList in deleteFile * feat(knowledge): enhance file handling with status updates and event emissions * feat: add similarity query functionality to RagPresenter and DuckDBPresenter * feat: implement similarity query in BuiltinKnowledgeServer and update KnowledgeFile component * feat: enhance BuiltinKnowledge module with detailed architecture and design documentation * feat: remove part of builtinKnowledge base info display * fix: fix file status switching bug * feat: add builtinKnowledge file search * fix: reemove redundant div * feat: enhance file handling process in BuiltinKnowledge design with detailed flow for file insertion and retrieval * feat: update BuiltinKnowledge design document with refined file handling and retrieval processes * feat: refactor BuiltinKnowledge module by replacing RagPresenter with KnowledgeStorePresenter and updating related components * feat: add builtinKnowledge file search score * feat: enhance error handling in file upload and re-upload processes in KnowledgeFile component * fix: fix overly long file names * fix: fix overly long file names * refactor: simplify checkpoint logic in DuckDBPresenter open method * feat: add @langchain/core dependency to enhance functionality * fix: update file extension handling to use correct variable name * feat: add crash reporter initialization for error tracking * fix: enhance logging and error handling in DuckDBPresenter methods * fix: move crash reporter initialization inside logging check * feat: add toast messages for model status and L2 normalization support in multiple languages * refactor: simplify fileTask method by removing unnecessary promise wrapping and adding comments * refactor: update model handling by removing unnecessary ModelConfig references and enhancing model info structure * fix: update company name format in crash reporter configuration * fix: fix embedding model default settings and revert ModelConfigItem changed * fix: cancel crash report * fix: fix pulling model type not assignable problem * fix: remove unneccessary files * fix: remove unnecessary files * fix: block option rerank model (not implemented yet) * fix: dynamically decide whether to show model customization configuration button * fix: remove useless i18n translations * fix: remove useless dependencies and improve definitions * perf: imporve knowledgePresenter resource release * perf: convert to async function for better error handling * perf: convert to async function for better error handling * perf: imporve vector utils * fix: fix error words * (WIP) feat: selectively enable mcp toolsets * perf: mark the interrupted task as a user-cancelled task when app startup * perf: add try-catch to enhance program stability * fix: declared but never read error * fix: missing attr file_id when insert vector(s) * perf: skip duckdb vss extension installation on macOS * fix: remove bad references * perf: disable auto install duckdb vss extension 1. will cause macOS sign problem 2. will increase 40Mb for build * perf: remove langchain from package, reduce package size * fix: declared but never read error * perf: use Bipolar Quadratic Mapping algorithm to ensure that the vector confidence is between [0,1] * perf: a more appropriate scaling factor * perf: knowledge config update logic * fix: update text fixed * fix: lint * feat:Add Groq as Provider * update groq.svg * update groqProvider.ts * (WIP) perf: enhance knowledge management with chunk processing and task scheduling features * feat: remove python code run on js * (WIP) feat: add clearDirtyData method to clean up orphaned vectors and chunks * (WIP) feat: enhance DuckDBPresenter with logging and new insertVectors method; update KnowledgeStorePresenter for chunk processing and status management * feat: refactor task management in KnowledgeTaskPresenter; enhance chunk processing and status handling in KnowledgeStorePresenter * feat: add enabledMcpTools field to conversation for controlling MCP tools * feat: filter MCP tools by enabledMcpTools * refactor: update task management and chunk processing in KnowledgePresenter and KnowledgeTaskPresenter; enhance error handling and metadata management * feat: enhance DuckDBPresenter and KnowledgeStorePresenter with error handling; update task management and chunk processing * feat: enhance task management in KnowledgeTaskPresenter; improve error handling and processing flow in KnowledgeStorePresenter; update file list handling in KnowledgeFile component * feat: refactor toggle logic for MCP service and tool state * feat: enhance file handling in KnowledgeStorePresenter; improve error handling and metadata management in KnowledgeFile and presenter.d.ts * feat: update DuckDBPresenter and presenter.d.ts; enhance transaction management and introduce new task status summary interface * refactor: remove obsolete RAG event constants for file progress, chunk completion, and task queue status * feat: add file progress tracking and event emission for file processing updates * fix: update DuckDB dependency to version 1.3.2-alpha.25; enhance database cleanup logic in KnowledgePresenter * feat: enhance KnowledgePresenter configuration management; improve store presenter handling and update method signature * feat: add dialog handling with DialogPresenter and MessageDialog component * feat: enhance dialog handling with improved response management and new closeable option * feat: refactor dialog handling to support timeout and response management with enhanced type definitions * feat: update dialog request types for consistency and clarity in MessageDialog component * feat: enhance MessageDialog component with i18n support for descriptions and improve dialog timeout handling * feat: enhance dialog handling with improved error management and response structure * feat: improve dialog error handling and response structure in DialogPresenter * fix: e2b key not working * (WIP) perf: enhance knowledge management with chunk processing and task scheduling features * feat: implement task management features for pausing and resuming tasks in DuckDB and Knowledge presenters * feat: implement database migration and metadata management in DuckDBPresenter * fix: ensure database version is set after migration completion * update githubCopilotProvider * update Copilot Model * feat: Refactor Knowledge Presenter and related components - Updated KnowledgePresenter design document to reflect new architecture and features, including improved lifecycle management and event handling. - Enhanced file processing flow in KnowledgeStorePresenter to ensure immediate feedback and error handling during file reading. - Modified KnowledgeFile.vue to support additional file types and improve file status handling in the UI. - Improved configuration management for Knowledge Presenter, allowing for better integration and user experience. * use provider check if model id is not provided * fix: reorder parameters in getEmbeddings method for consistency across providers * feat: add export markdown * check copilot provider by model * update GitHubCopilotOAuth.vue * fix: remove redundant 'redetectDimensions' translations from multiple language settings * wip: better style * wip: fix worker * chore: remove unuse code * feat: add i18n * fix: format * fix: convert uploadedAt to string for consistent data handling * fix: lint * docs: add comprehensive documentation for Dialog module and its components * fix: i18n and ai review * Update src/main/events.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update src/main/lib/textsplitters/index.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update src/renderer/src/lib/utils.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * refactor: improve error handling and logging in dialog and knowledge task presenters; update text sanitization and localization * fix: #623 * feat: change function name * feat: add empty data display * feat: add click outside to close sidebar functionality * style(threads): optimize the operation logic of new sessions (#633) * style(threads): optimize the operation logic of new sessions * chore: format code * chore(ci): add code lint check (#634) * chore(ci): add code lint check * chore: remove linting steps from build workflow; add linting steps to PR check workflow * fix: resolve sidebar toggle button conflict (#637) * fix: Bugfix/gemini thinking (#639) * fix: gemini reasoning by config * feat: support gemini thinking * fix: user define model config first * fix: format * chore: ignore md for format * doc: remove empty line * fix: ai review * perf(ChatConfig): Set the TooltipProvider component to add a delay duration of 200& update the include configuration in the tsconfig.web.json file (#640) * feat: Add thinking budget support for Gemini 2.5 series models (#643) * chore: update 0.2.7 --------- Co-authored-by: hllshiro <40970081+hllshiro@users.noreply.github.com> Co-authored-by: ysli <sqsyli@qq.com> Co-authored-by: zhangmo8 <wegi866@gmail.com> Co-authored-by: dw9 <xweimvp@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: yyhhyyyyyy <yyhhyyyyyy8@gmail.com> Co-authored-by: 阿菜 Cai <1064425721@qq.com> Co-authored-by: 阿菜 Cai <jimmyrss1102@gmail.com> Co-authored-by: flingyp <flingyp@163.com>
Add thinking budget support for Gemini 2.5 series models

Summary by CodeRabbit
New Features
Localization