Skip to content

Conversation

@neoragex2002
Copy link
Contributor

@neoragex2002 neoragex2002 commented Sep 11, 2025

feat: add chatConfig entry for gemini search option

Summary by CodeRabbit

  • New Features

    • Added Gemini web search configuration in chat settings alongside the existing provider.
    • Introduced a dedicated UI block with a unified enable/disable toggle for web search.
  • Chores

    • Added a setting description warning that enabling web search disables tool/function calls.
    • Updated translations for this notice across locales: en, fa, fr, ja, ko, ru, zh-CN, zh-HK, zh-TW.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 11, 2025

Walkthrough

Adds Gemini-specific search configuration UI to ChatConfig.vue alongside existing Dashscope handling via separate computed flags; introduces a new i18n key searchLimit across multiple locale files describing that enabling web search disables tool function calls.

Changes

Cohort / File(s) Summary
Chat configuration UI
src/renderer/src/components/ChatConfig.vue
Adds showGeminiSearchConfig computed and a Gemini search config UI block; renames showSearchConfigshowDashscopeSearchConfig; both blocks bind to enableSearch and emit update:enableSearch. No prop/emit signatures changed.
i18n: model search limitation text
src/renderer/src/i18n/*/settings.json
src/renderer/src/i18n/en-US/settings.json, src/renderer/src/i18n/fa-IR/settings.json, src/renderer/src/i18n/fr-FR/settings.json, src/renderer/src/i18n/ja-JP/settings.json, src/renderer/src/i18n/ko-KR/settings.json, src/renderer/src/i18n/ru-RU/settings.json, src/renderer/src/i18n/zh-CN/settings.json, src/renderer/src/i18n/zh-HK/settings.json, src/renderer/src/i18n/zh-TW/settings.json
Adds searchLimit translation entry (label and/or description per locale) under the model/modelConfig (or model.validation) section conveying that enabling web search disables tool function calls. Pure localization 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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • zerob13

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The current PR description contains only the title and does not follow the repository's required template; it is missing a problem statement, a clear solution description, UI/UX details (screenshots/GIFs) if applicable, platform compatibility notes, testing steps, and any additional context or links. Please update the PR description to follow the provided template: include a concise problem statement, the proposed solution, detailed UI/UX changes with screenshots or GIFs when applicable, platform compatibility and testing instructions, files/changes of interest (e.g., ChatConfig.vue and i18n entries), and any related issue links; also fill the Chinese template section if required by the project. After adding these details, request reviewers or note testing steps so reviewers can validate behavior.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "feat: add chatConfig entry for gemini search option" is concise and directly describes the primary change (adding a chatConfig entry to enable a Gemini search option), uses a conventional feat: prefix, and avoids noise; a reviewer scanning history will understand the main intent.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

A hop, a toggle, new lights gleam,
Gemini joins the config team.
In many tongues the caution sings:
"Search may hush the tool-call things."
I nibble code and beat my drum — hooray, changes done! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ac10d6 and 607a5ee.

📒 Files selected for processing (8)
  • 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-HK/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-TW/settings.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6e8a51e and 7ac10d6.

📒 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.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/components/ChatConfig.vue
  • src/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'?

@zerob13 zerob13 merged commit bf7c960 into ThinkInAIXYZ:dev Sep 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants