-
Notifications
You must be signed in to change notification settings - Fork 625
feat: add chatConfig entry for gemini search option #891
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
Conversation
WalkthroughAdds Gemini-specific search configuration UI to ChatConfig.vue alongside existing Dashscope handling via separate computed flags; introduces a new i18n key Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant ChatConfig as ChatConfig.vue
participant Parent as ParentComponent
rect rgb(220,235,255)
Note over ChatConfig: compute visibility flags
ChatConfig->>ChatConfig: compute showDashscopeSearchConfig
ChatConfig->>ChatConfig: compute showGeminiSearchConfig
ChatConfig->>User: render relevant search config block(s)
end
User->>ChatConfig: toggle "Enable Search"
ChatConfig-->>Parent: emit update:enableSearch(value)
Parent->>Parent: persist updated setting
Parent-->>ChatConfig: pass updated prop
ChatConfig->>ChatConfig: re-evaluate computed flags and re-render
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (8)
✨ 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. Comment |
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: 7
🧹 Nitpick comments (3)
src/renderer/src/components/ChatConfig.vue (3)
155-179: Avoid per-render allocations; hoist Dashscope model list and use lowercased id once. Also switch comment to English.Creates a new array every compute and lowercases repeatedly. Hoist constants and simplify matching.
Apply this diff here:
-// 是否显示搜索配置 - 支持 Dashscope 的特定模型 +// Show search configuration for Dashscope-supported models const showDashscopeSearchConfig = computed(() => { const isDashscope = props.providerId === 'dashscope' if (!isDashscope || !props.modelId) return false - // Dashscope - ENABLE_SEARCH_MODELS - const enableSearchModels = [ - 'qwen3-max-preview', - 'qwen3-max', - 'qwen-max', - 'qwen-plus', - 'qwen-plus-latest', - 'qwen-plus-2025-07-14', - 'qwen-flash', - 'qwen-flash-2025-07-28', - 'qwen-turbo', - 'qwen-turbo-latest', - 'qwen-turbo-2025-07-15', - 'qwq-plus' - ] - - return enableSearchModels.some((modelName) => - props.modelId?.toLowerCase().includes(modelName.toLowerCase()) - ) + const id = (props.modelId || '').toLowerCase() + return DASH_SCOPE_ENABLE_SEARCH_MODELS.some((name) => id.includes(name)) })Add these constants near the top of the script (after imports):
// Dashscope models that support web search (lowercase for fast matching) const DASH_SCOPE_ENABLE_SEARCH_MODELS = [ 'qwen3-max-preview', 'qwen3-max', 'qwen-max', 'qwen-plus', 'qwen-plus-latest', 'qwen-plus-2025-07-14', 'qwen-flash', 'qwen-flash-2025-07-28', 'qwen-turbo', 'qwen-turbo-latest', 'qwen-turbo-2025-07-15', 'qwq-plus' ] as const
181-203: Same improvement for Gemini: hoist model list; lowercase once. Also translate the inline comment.Keeps allocations in the reactive path; fix like Dashscope.
Apply this diff:
-// 是否显示搜索配置 - 支持 Gemini 的特定模型 +// Show search configuration for Gemini-supported models const showGeminiSearchConfig = computed(() => { - const isSearchableModel = props.providerId === 'gemini' - - if (!isSearchableModel || !props.modelId) return false - - // ENABLE_SEARCH_MODELS - const enableSearchModels = [ - 'gemini-2.5-pro', - 'gemini-2.5-flash', - 'gemini-2.5-flash-lite', - 'gemini-2.5-flash-lite-preview-06-17', - 'gemini-2.0-flash', - 'gemini-2.0-flash-lite', - 'gemini-1.5-pro', - 'gemini-1.5-flash' - ] - - return enableSearchModels.some((modelName) => - props.modelId?.toLowerCase().includes(modelName.toLowerCase()) - ) + if (props.providerId !== 'gemini' || !props.modelId) return false + const id = (props.modelId || '').toLowerCase() + return GEMINI_ENABLE_SEARCH_MODELS.some((name) => id.includes(name)) })Add these constants near the Dashscope constants:
// Gemini models that support web search (lowercase) const GEMINI_ENABLE_SEARCH_MODELS = [ 'gemini-2.5-pro', 'gemini-2.5-flash', 'gemini-2.5-flash-lite', 'gemini-2.5-flash-lite-preview-06-17', 'gemini-2.0-flash', 'gemini-2.0-flash-lite', 'gemini-1.5-pro', 'gemini-1.5-flash' ] as const
606-647: Minor copy: use English in the template comment per repo guidelines.Aligns with “Use English for all logs and comments”.
Apply this diff:
- <!-- Search Configuration (Gemini联网搜索配置) --> + <!-- Search Configuration (Gemini web search) -->
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
src/renderer/src/components/ChatConfig.vue(3 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)
🧰 Additional context used
📓 Path-based instructions (11)
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/zh-TW/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/components/ChatConfig.vuesrc/renderer/src/i18n/ru-RU/settings.json
src/renderer/**/*.{vue,ts,js,tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
渲染进程代码放在
src/renderer
Files:
src/renderer/src/components/ChatConfig.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/ChatConfig.vue
src/renderer/src/**/*.vue
📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)
Use scoped styles to prevent CSS conflicts between components
Files:
src/renderer/src/components/ChatConfig.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/ChatConfig.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/ChatConfig.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.Use Pinia for frontend state management (do not introduce alternative state libraries)
Files:
src/renderer/src/components/ChatConfig.vue
**/*.{ts,tsx,js,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Use English for all logs and comments
Files:
src/renderer/src/components/ChatConfig.vue
**/*.{ts,tsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Enable and adhere to strict TypeScript typing (avoid implicit any, prefer precise types)
Files:
src/renderer/src/components/ChatConfig.vue
src/renderer/{src,shell,floating}/**/*.vue
📄 CodeRabbit inference engine (CLAUDE.md)
src/renderer/{src,shell,floating}/**/*.vue: Use Vue 3 Composition API for all components
All user-facing strings must use i18n keys via vue-i18n (no hard-coded UI strings)
Use Tailwind CSS utilities and ensure styles are scoped in Vue components
Files:
src/renderer/src/components/ChatConfig.vue
src/renderer/src/components/**/*
📄 CodeRabbit inference engine (CLAUDE.md)
Organize UI components by feature within src/renderer/src/
Files:
src/renderer/src/components/ChatConfig.vue
🧠 Learnings (2)
📓 Common learnings
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts:258-324
Timestamp: 2025-06-21T15:53:34.641Z
Learning: User neoragex2002 prefers concise, brief responses rather than chatty or verbose communication. Avoid lengthy explanations, excessive enthusiasm, or ASCII art in responses.
📚 Learning: 2025-07-21T01:46:30.354Z
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/zh-TW/settings.json
🪛 GitHub Actions: PR Check
src/renderer/src/i18n/zh-TW/settings.json
[error] 1-1: Missing translation key 'model.modelConfig.searchLimit.label' in locale zh-TW.
src/renderer/src/i18n/en-US/settings.json
[error] 1-1: Missing translation key 'model.modelConfig.searchLimit.label' in locale en-US.
src/renderer/src/i18n/fr-FR/settings.json
[error] 1-1: Missing translation key 'model.modelConfig.searchLimit.label' in locale fr-FR.
src/renderer/src/i18n/zh-HK/settings.json
[error] 1-1: Missing translation key 'model.modelConfig.searchLimit.label' in locale zh-HK.
src/renderer/src/i18n/ko-KR/settings.json
[error] 1-1: Missing translation key 'model.modelConfig.searchLimit.label' in locale ko-KR.
src/renderer/src/i18n/fa-IR/settings.json
[error] 1-1: Missing translation key 'model.modelConfig.searchLimit.label' in locale fa-IR.
src/renderer/src/i18n/ja-JP/settings.json
[error] 1-1: Missing translation key 'model.modelConfig.searchLimit.label' in locale ja-JP.
src/renderer/src/i18n/ru-RU/settings.json
[error] 1-1: Missing translation key 'model.modelConfig.searchLimit.label' in locale ru-RU.
🔇 Additional comments (3)
src/renderer/src/i18n/zh-CN/settings.json (1)
166-169: LGTM — label present.This locale already includes both label and description for searchLimit.
src/renderer/src/i18n/fr-FR/settings.json (1)
257-259: Fix CI: add missing searchLimit.label and searchLimit.description to locales.Verification shows these locale settings.json files are missing both keys; add them under the "searchLimit" object to restore CI.
- src/renderer/src/i18n/zh-TW/settings.json
- src/renderer/src/i18n/fr-FR/settings.json
- src/renderer/src/i18n/fa-IR/settings.json
- src/renderer/src/i18n/en-US/settings.json
- src/renderer/src/i18n/ru-RU/settings.json
- src/renderer/src/i18n/ko-KR/settings.json
- src/renderer/src/i18n/zh-HK/settings.json
- src/renderer/src/i18n/zh-CN/settings.json
- src/renderer/src/i18n/ja-JP/settings.json
Suggested fr-FR label: "Limitation de la recherche". Add both label and description entries in each file.
⛔ Skipped due to learnings
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'src/renderer/src/components/ChatConfig.vue (1)
639-645: Confirm whether Gemini should expose forcedSearch/searchStrategy as Dashscope does.If Gemini supports similar flags, consider adding them for parity; otherwise, keep as-is.
Would you like me to add a guarded UI for these options behind providerId === 'gemini'?
feat: add chatConfig entry for gemini search option
Summary by CodeRabbit
New Features
Chores