Skip to content

Conversation

@yyhhyyyyyy
Copy link
Collaborator

@yyhhyyyyyy yyhhyyyyyy commented Aug 13, 2025

disable automatic model enabling for better UX
implemented the first point of this issue #733 .

Summary by CodeRabbit

  • New Features

    • Added an empty-state message in Provider settings when no models are enabled, guiding users to enable models.
    • Localized the new message across en, fa, fr, ja, ko, ru, zh-CN, zh-HK, and zh-TW.
  • Changes

    • Models are no longer auto-enabled; users must manually enable desired models.
    • Default status for models without an explicit setting now treats them as disabled.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 13, 2025

Walkthrough

Default model status now falls back to false when missing/non-boolean. Automatic model auto-enable logic is removed from providers, including Gemini; providers now only log and require manual enabling. UI adds an empty-state card when no models are enabled, with new i18n strings across several locales.

Changes

Cohort / File(s) Summary of Changes
Config Presenter defaults
src/main/presenter/configPresenter/index.ts
Change default model status fallback from true to false in getModelStatus and getBatchModelStatus; no API signature changes.
Base provider auto-enable removal
src/main/presenter/llmProviderPresenter/baseProvider.ts
Remove auto-enabling all models when none are enabled; replace with info log instructing manual enablement.
Gemini provider auto-enable removal
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
Remove recommended-model auto-enable and fuzzy matching; delete isModelRecommended; add info log to prompt manual enablement.
Settings UI empty state
src/renderer/src/components/settings/ProviderModelManager.vue
Add conditional rendering: show dashed info card when there are provider models but none are enabled; no script/prop changes.
i18n additions for empty state
src/renderer/src/i18n/en-US/settings.json, .../fa-IR/settings.json, .../fr-FR/settings.json, .../ja-JP/settings.json, .../ko-KR/settings.json, .../ru-RU/settings.json, .../zh-CN/settings.json, .../zh-HK/settings.json, .../zh-TW/settings.json
Add provider.noModelsEnabled { title, description } strings for “no models enabled” UI state; data-only changes.

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant Provider
  participant Config

  App->>Provider: loadModels()
  Provider->>Config: fetch enabled model IDs
  alt none enabled
    Provider->>App: log "Please manually enable models"
  else some enabled
    Provider-->>App: models ready
  end
Loading
sequenceDiagram
  participant Caller
  participant Config

  Caller->>Config: getModelStatus(modelId)
  alt status in cache/storage is boolean
    Config-->>Caller: return stored boolean
  else missing/non-boolean
    Config-->>Caller: return false
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • zerob13

Poem

A hop and a stop—no switches pre-flipped,
Models now wait, with ears neatly tipped.
If none are enabled, don’t fret or despair,
Click “Enable Models,” select with care.
Defaults turn to false, as burrows decree—
I’ll nibble some logs while you pick what’ll be. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/disable-auto-model-enabling

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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (3)
src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts (2)

360-366: Bug: Comparing enum values to strings in safety settings filter

threshold is of type HarmBlockThreshold (enum). The checks against string literals always pass, so BLOCK_NONE and UNSPECIFIED won’t be filtered out as intended.

Apply this diff to compare against enum constants:

-        if (
-          threshold &&
-          category &&
-          threshold !== 'BLOCK_NONE' &&
-          threshold !== 'HARM_BLOCK_THRESHOLD_UNSPECIFIED'
-        ) {
+        if (
+          threshold !== undefined &&
+          category !== undefined &&
+          threshold !== HarmBlockThreshold.BLOCK_NONE &&
+          threshold !== HarmBlockThreshold.HARM_BLOCK_THRESHOLD_UNSPECIFIED
+        ) {
           safetySettings.push({ category, threshold })
         }

Also ensure HarmBlockThreshold is in scope (it already is via import).


865-906: Reduce PII-heavy and noisy logs; gate debug output

console.log of modelConfig, safetySettings, requestParams, and especially entire chunk.candidates can leak user content and degrade performance.

Two options:

  • Preferred: remove these logs entirely or switch to a structured logger with levels.
  • Minimal: gate with an app-wide debug flag and use console.debug.

Example minimal gating:

-    console.log('modelConfig', modelConfig, modelId)
+    if (this.configPresenter.getLoggingEnabled?.()) {
+      console.debug('modelConfig', { modelId, reasoning: modelConfig?.reasoning })
+    }
...
-    console.log('safetySettings', safetySettings)
+    if (this.configPresenter.getLoggingEnabled?.()) {
+      console.debug('safetySettings.present', Boolean(safetySettings))
+    }
...
-    console.log('requestParams', requestParams)
+    if (this.configPresenter.getLoggingEnabled?.()) {
+      console.debug('requestParams.meta', { modelId: requestParams.model, hasTools: !!requestParams.config?.tools })
+    }
...
-      console.log('chunk.candidates', JSON.stringify(chunk.candidates, null, 2))
+      if (this.configPresenter.getLoggingEnabled?.()) {
+        console.debug('chunk.candidates.present', !!(chunk.candidates && chunk.candidates.length))
+      }

This retains useful signals while avoiding raw payload logging.

Also applies to: 900-906, 939-969, 945-945

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

237-241: Button label “enableModels” appears mistranslated; likely swapped with “modelsEnabled”.

In this file:

  • enableModels currently is "模型已經啟用" (Models have been enabled), which reads like a status/toast, not an action.
  • modelsEnabled at Line 322 is also "模型已經啟用" (correct for status).

This likely breaks the CTA label consistency and could confuse users. Recommend updating enableModels to the action label “啟用模型”.

Apply this diff:

-    "enableModels": "模型已經啟用",
+    "enableModels": "啟用模型",
🧹 Nitpick comments (6)
src/main/presenter/llmProviderPresenter/baseProvider.ts (2)

133-138: Stop auto-enabling and log instead: correct behavior; update the comment to English

The behavior change is correct and supports manual enablement. However, the inline comment is Chinese and should be in English per guidelines.

Apply this diff to align the comment with the codebase guidelines:

-    // 不再自动启用模型,让用户手动选择启用需要的模型
+    // Do not auto-enable models anymore; require users to manually enable the models they need

122-131: “Manual modification” detection only checks for enabled=true, not explicit disables

hasManuallyModifiedModels returns true only if any model status resolves to true. If a user explicitly disabled all models, this still returns false and you’ll log the “please manually enable” message on every init/refresh. If you want to suppress that log in the “all explicitly disabled” case, detect the presence of any stored status (true or false), not just enabled.

One way: add a method on ConfigPresenter to check if a status key exists, and use it here to detect “manually-touched” models. For example:

-    const hasManuallyModifiedModels = this.models.some((model) =>
-      this.configPresenter.getModelStatus(providerId, model.id)
-    )
+    // Consider a model "manually modified" if its status key exists (true or false)
+    const hasManuallyModifiedModels = this.models.some((model) => {
+      const statusKey = (this as any).getModelStatusKey
+        ? (this as any).getModelStatusKey(providerId, model.id)
+        : `model_status_${providerId}_${model.id.replace(/\./g, '-')}`;
+      // Prefer a dedicated ConfigPresenter.hasSetting(key) API if available
+      return this.configPresenter.getSetting<boolean | undefined>(statusKey) !== undefined;
+    })

If you prefer not to expose storage details here, add a ConfigPresenter.hasModelStatus(providerId, modelId) helper and call that instead.

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

336-341: No-op auto-enable: consider removing this override and inherit base behavior

Now that auto-enabling is removed, the Gemini-specific override just logs the same message as the base class. Prefer deleting the override to avoid duplication and reduce maintenance.

Apply this diff to remove the redundant method and use BaseLLMProvider.autoEnableModelsIfNeeded:

-  /**
-   * 重写 autoEnableModelsIfNeeded 方法
-   * 只自动启用与 GEMINI_MODELS 中定义的推荐模型相匹配的模型
-   */
-  protected async autoEnableModelsIfNeeded() {
-    if (!this.models || this.models.length === 0) return
-    const providerId = this.provider.id
-
-    // 检查是否有自定义模型
-    const customModels = this.configPresenter.getCustomModels(providerId)
-    if (customModels && customModels.length > 0) return
-
-    // 检查是否有任何模型的状态被手动修改过
-    const hasManuallyModifiedModels = this.models.some((model) =>
-      this.configPresenter.getModelStatus(providerId, model.id)
-    )
-    if (hasManuallyModifiedModels) return
-
-    // 检查是否有任何已启用的模型
-    const hasEnabledModels = this.models.some((model) =>
-      this.configPresenter.getModelStatus(providerId, model.id)
-    )
-
-    // 不再自动启用模型,让用户手动选择启用需要的模型
-    if (!hasEnabledModels) {
-      console.info(
-        `Provider ${this.provider.name} models loaded, please manually enable the models you need`
-      )
-    }
-  }
src/renderer/src/i18n/en-US/settings.json (1)

244-244: Optional: reference the localized button label via interpolation

To prevent drift if the Enable Models label changes, consider using a placeholder and pass the current button label from the component.

Example i18n text (this file):

"Please click the \"{buttonLabel}\" button to manually select the models you want to use."

And in the Vue template:

{{ t('settings.provider.noModelsEnabled.description', { buttonLabel: t('settings.provider.enableModels') }) }}
src/renderer/src/components/settings/ProviderModelManager.vue (1)

53-68: Avoid hard-coded color; use theme token

Prefer theme variables for colors to respect light/dark modes and theming. Replace text-blue-500 with a semantic token (e.g., text-primary or text-muted-foreground).

Apply this diff:

-        <Icon icon="lucide:info" class="w-5 h-5 text-blue-500" />
+        <Icon icon="lucide:info" class="w-5 h-5 text-primary" />
src/renderer/src/i18n/fr-FR/settings.json (1)

244-244: Optional: use interpolation for the button label

To avoid drift if the button label changes, consider:

JSON:

"Veuillez cliquer sur le bouton « {buttonLabel} » pour sélectionner manuellement les modèles que vous souhaitez utiliser."

Vue:

{{ t('settings.provider.noModelsEnabled.description', { buttonLabel: t('settings.provider.enableModels') }) }}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 82f408a and e14c878.

📒 Files selected for processing (13)
  • src/main/presenter/configPresenter/index.ts (2 hunks)
  • src/main/presenter/llmProviderPresenter/baseProvider.ts (1 hunks)
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts (1 hunks)
  • src/renderer/src/components/settings/ProviderModelManager.vue (2 hunks)
  • src/renderer/src/i18n/en-US/settings.json (1 hunks)
  • src/renderer/src/i18n/fa-IR/settings.json (1 hunks)
  • src/renderer/src/i18n/fr-FR/settings.json (1 hunks)
  • src/renderer/src/i18n/ja-JP/settings.json (1 hunks)
  • src/renderer/src/i18n/ko-KR/settings.json (1 hunks)
  • src/renderer/src/i18n/ru-RU/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-CN/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-HK/settings.json (1 hunks)
  • src/renderer/src/i18n/zh-TW/settings.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (17)
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/ko-KR/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/components/settings/ProviderModelManager.vue
  • src/renderer/src/i18n/zh-HK/settings.json
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Use English for logs and comments

Files:

  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
  • src/renderer/src/components/settings/ProviderModelManager.vue
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Strict type checking enabled for TypeScript

**/*.{ts,tsx}: 始终使用 try-catch 处理可能的错误
提供有意义的错误信息
记录详细的错误日志
优雅降级处理
日志应包含时间戳、日志级别、错误代码、错误描述、堆栈跟踪(如适用)、相关上下文信息
日志级别应包括 ERROR、WARN、INFO、DEBUG
不要吞掉错误
提供用户友好的错误信息
实现错误重试机制
避免记录敏感信息
使用结构化日志
设置适当的日志级别

Files:

  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
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/configPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • 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/configPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts
src/main/presenter/configPresenter/**/*.ts

📄 CodeRabbit Inference Engine (CLAUDE.md)

Centralize configuration in configPresenter/

Files:

  • src/main/presenter/configPresenter/index.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development-setup.mdc)

**/*.{js,jsx,ts,tsx}: 使用 OxLint 进行代码检查
Log和注释使用英文书写

Files:

  • src/main/presenter/configPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • 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/configPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • 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/configPresenter/index.ts
  • src/main/presenter/llmProviderPresenter/baseProvider.ts
  • 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 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.
Provider implementations must use a coreStream method that yields standardized stream events to decouple the main loop from provider-specific details.
The coreStream method 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 as formatMessages, convertToProviderTools, parseFunctionCalls, and prepareFunctionCallPrompt as 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., using convertToProviderTools) 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/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 components

Use scoped styles to prevent CSS conflicts between components

Files:

  • src/renderer/src/components/settings/ProviderModelManager.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/ProviderModelManager.vue
src/renderer/**/*.{vue,ts,js,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)

渲染进程代码放在 src/renderer

Files:

  • src/renderer/src/components/settings/ProviderModelManager.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/ProviderModelManager.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/ProviderModelManager.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/ProviderModelManager.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/ProviderModelManager.vue
🧠 Learnings (4)
📚 Learning: 2025-07-21T01:45:33.790Z
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

Applied to files:

  • src/main/presenter/llmProviderPresenter/baseProvider.ts
📚 Learning: 2025-07-21T01:46:52.880Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should implement helper methods such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed for provider-specific logic.

Applied to files:

  • src/main/presenter/llmProviderPresenter/baseProvider.ts
📚 Learning: 2025-07-21T01:45:33.790Z
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

Applied to files:

  • src/main/presenter/llmProviderPresenter/baseProvider.ts
📚 Learning: 2025-07-21T01:46:52.880Z
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.

Applied to files:

  • src/main/presenter/llmProviderPresenter/baseProvider.ts
🔇 Additional comments (13)
src/main/presenter/configPresenter/index.ts (2)

334-338: Default to disabled when status is missing: correct and aligned with PR objective

Switching the fallback to false avoids unexpected auto-enabling and matches the new UX. Good change.

This change will cause all previously “unset” model statuses to be treated as disabled. If you expect any legacy installs to rely on the old default-true behavior, confirm whether a one-time migration prompt or release note is needed.


362-367: Batch status defaulting to false: consistent with single-read path

The batch path now mirrors getModelStatus semantics, ensuring consistency across code paths.

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

243-246: New no-models-enabled copy: looks good

Strings are clear and align with the new manual-enable UX.

Confirm that ProviderModelManager.vue references provider.noModelsEnabled.title and .description and that equivalent keys were added to all supported locales (en-US, zh-HK, etc.) to avoid fallback to raw keys at runtime.

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

242-245: Added Traditional Chinese no-models-enabled copy: looks good

Consistent with Simplified Chinese and aligns with UI state.

Ensure the new keys are used by the renderer and that all locales include them to prevent missing translation warnings.

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

241-244: All locales updated with empty-state strings

Verified that every settings.json under src/renderer/src/i18n now contains both provider.noModelsEnabled and enableModels. No missing translations were found across all supported locales. Changes are complete and consistent—approving merge.

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

242-245: JP translation is clear and matches the UI flow.

The title/description are idiomatic and correctly point users to the 「モデルを有効にする」 button. Key naming is aligned with other locales.

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

241-244: RU translation aligns with the feature change and UI wording.

The empty-state guidance is concise and uses «…» around the button label, which is appropriate for RU. Keys and structure match other locales.

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

323-326: Empty-state strings read well and match the intended UX.

The added provider.noModelsEnabled.title/description are natural and guide the user to the correct action. Good addition.

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

242-245: FA addition is correct and aligns with the manual-enable UX.

The title/description clearly instruct the user to click «روشن کردن مدل‌ها». Keys match the structure used by other locales.

As a follow-up, consider auditing placeholders in this locale to ensure runtime interpolation safety (e.g., using {model}, {count} with ASCII braces and keys). I can help scan and propose fixes in a separate PR if you’d like.

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

242-245: Dismiss comma suggestion – JSON is already valid

The noModelsEnabled entries in all settings.json files already include the required trailing comma, and jq validation confirmed there are no parsing errors. No changes are needed here.

Likely an incorrect or invalid review comment.

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

33-36: Good conditional rendering for enabled models list

Showing the list only when enabledModels.length > 0 aligns with the new "manual enabling" UX and keeps the UI clean.


53-68: Confirm the zero-models case UX

When totalModelsCount === 0 nothing is rendered here. Ensure there’s a separate empty state or guidance elsewhere (e.g., a “Refresh Models”/“Pull Models” CTA) so users know how to fetch models.

If needed, I can help add a similar empty-state branch for totalModelsCount === 0 using existing i18n keys (e.g., settings.provider.modelCheck.noModels).

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

242-245: noModelsEnabled entry already includes the trailing comma – no changes needed

The snippet in src/renderer/src/i18n/fr-FR/settings.json (lines 242–245) already has a comma after the closing brace of noModelsEnabled, so the JSON is valid as-is.

Likely an incorrect or invalid review comment.

@zerob13 zerob13 merged commit bce1fec into dev Aug 13, 2025
2 checks passed
zerob13 added a commit that referenced this pull request Aug 13, 2025
* fix: add AlertDialogDescription to resolve accessibility warning (#706)

* fix: resolve focus flicker when creating new windows with Ctrl+Shift+N (#707)

* feat: enhance window management by implementing main window ID handling (#709)

* docs: update zhipu developer doc website link (#715)

Co-authored-by: gongchao <chao.gong@aminer.cn>

* refactor: better translate (#716)

* chore: en-us i18n

* chore(i18n): polish ja-JP translations across UI; keep chat.input.placeholder unchanged

* chore(i18n): polish fr-FR translations; keep chat.input.placeholder unchanged

* chore(i18n): refine fr-FR MCP & Settings copy; idiomatic, concise, brand-consistent

* chore(i18n): polish ru-RU translations across UI; keep chat.input.placeholder unchanged

* chore(i18n): polish fa-IR translations across UI; keep chat.input.placeholder unchanged

* chore: fix format

* chore: fix i18n

* chore: lock rolldown-vite version

* feat: add GPT-5 series model support (#717)

* ci(vite): Bundle the main file into a single file to speed up loading. (#718)

* fix(math): parser by upgrade vue-renderer-markdown (#722)

* chore: bump deps (#721)

* chore: bump deps

* fix: rolldown-vite 7.1.0 and duckdb bundle issue

* chore: back to vite

* chore: update electron

* chore: update versions

* fix(math): parser by upgrade vue-renderer-markdown (#722)

* chore: bump deps

---------

Co-authored-by: Simon He <57086651+Simon-He95@users.noreply.github.com>

* fix: add scrollable support to PopoverContent to prevent overflow (#720)

* feat: implement floating chat window system with performance optimization (#724)

* feat: add mcp sync and modelscope provider #615 (#723)

* wip: add modelscope provider

* feat: add mcp sync to modelscope

* fix: add scrollable support to PopoverContent to prevent overflow (#720)

* feat: implement floating chat window system with performance optimization (#724)

* chore: i18n and format

* feat: better style

* fix: mcp tool display

---------

Co-authored-by: yyhhyyyyyy <yyhhyyyyyy8@gmail.com>

* fix: move_files newPath parse issue (#725)

* fix: move_files newPath 参数计算规则

* fix: move_files 移动前需要判断dest是目录还是文件

* feat: add Claude Opus 4.1 to anthropic default model list (#726)

* feat: Add mcprouter's MCP marketplace api support (#727)

* wip: add mcp market

* feat: mcp market install

* wip: mcp install status sync

* feat: mcp server config mask

* chore: remove working doc

* chore: add translate

* feat: add ESC key to close floating chat window (#728)

* feat: add floating button position persistence with boundary validation (#729)

* feat: add floating button position persistence with boundary validation

* feat: refactor floating button to use electron-window-state

* chore: bump to 0.3.0

* feat: add reasoning_effort parameter support for gpt-oss models (#731)

* feat: add reasoning_effort parameter support for gpt-oss models

- add reasoning effort UI support across all components

* fix: preserve user reasoning effort settings and improve display logic

* fix: artifacts code not streaming (#732)

* fix: artifact react load failed

* chore: remove log

* fix: artifacts code not stream

* fix: format

* feat: disable automatic model enabling for better UX (#734)

* feat: sync provider sorting from settings to model selection (#736)

* feat: sync provider sorting from settings to model selection

* feat: refactor ModelSelect to use computed providers for better reactivity

---------

Co-authored-by: yyhhyyyyyy <yyhhyyyyyy8@gmail.com>
Co-authored-by: hllshiro <40970081+hllshiro@users.noreply.github.com>
Co-authored-by: tomsun28 <tomsun28@outlook.com>
Co-authored-by: gongchao <chao.gong@aminer.cn>
Co-authored-by: Simon He <57086651+Simon-He95@users.noreply.github.com>
Co-authored-by: wanna <wanna.w@binarywalk.com>
@zerob13 zerob13 deleted the feat/disable-auto-model-enabling branch November 23, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants