Skip to content

Conversation

@zerob13
Copy link
Collaborator

@zerob13 zerob13 commented Nov 25, 2025

Summary by CodeRabbit

  • New Features

    • Custom model creation and editing now use a modal dialog flow with name/id fields, validation, and duplicate-ID detection.
    • Create and edit modes supported for custom and provider models; UI disables add when no primary provider.
  • Bug Fixes

    • Mention-related data now populates immediately on load for files, resources, tools, and prompts.
  • Documentation

    • Added localized UI text for model configuration across supported languages.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Walkthrough

Replaces inline add/edit custom-model inputs with a modal ModelConfigDialog (create/edit modes and identity validation). Adds immediate watchers in useMentionData. Extends ModelConfigDialog props and logic for create/custom flows. Adds i18n entries for model identity and dialog titles across locales.

Changes

Cohort / File(s) Summary
Provider list & dialog wiring
src/renderer/settings/components/ProviderModelList.vue, src/renderer/src/components/settings/ModelConfigItem.vue
Removes inline add/edit inputs and temporary add state; introduces dialog-based add flow (showAddModelDialog, openAddModelDialog, primaryProviderId gating). Passes mode="edit" and :is-custom-model to ModelConfigDialog from ModelConfigItem.
ModelConfigDialog: create/edit & identity
src/renderer/src/components/settings/ModelConfigDialog.vue
Adds `mode?: 'create'
Watcher timing change
src/renderer/src/components/chat-input/composables/useMentionData.ts
Adds immediate: true to four watchers (selectedFiles, mcpStore.resources, mcpStore.tools, mcpStore.prompts) so mentionData is populated on setup.
Internationalization additions
src/renderer/src/i18n/*/settings.json
src/renderer/src/i18n/en-US/settings.json, .../fa-IR/..., .../fr-FR/..., .../ja-JP/..., .../ko-KR/..., .../pt-BR/..., .../ru-RU/..., .../zh-CN/..., .../zh-HK/..., .../zh-TW/...
Adds modelConfig.name and modelConfig.id objects (label, description, placeholder, required, readonly; id includes duplicate) and modelConfig.createTitle / modelConfig.editTitle strings across locales to support custom-model identity UI.

Sequence Diagram

sequenceDiagram
    participant User
    participant ProviderModelList
    participant ModelConfigDialog
    participant ModelStore

    rect rgb(200,220,255)
    Note over ProviderModelList: Old inline add (removed)
    User->>ProviderModelList: Click Add
    ProviderModelList->>ProviderModelList: Show inline inputs
    User->>ProviderModelList: Confirm
    ProviderModelList->>ModelStore: Save model
    end

    rect rgb(220,255,220)
    Note over ModelConfigDialog: New dialog-based flow
    User->>ProviderModelList: Click Add
    ProviderModelList->>ModelConfigDialog: Open (mode=create)
    User->>ModelConfigDialog: Fill identity & config
    ModelConfigDialog->>ModelConfigDialog: Validate id/name & conflicts
    User->>ModelConfigDialog: Save
    ModelConfigDialog->>ModelStore: addCustomModel + setModelConfig
    ModelConfigDialog->>ProviderModelList: emit 'saved'
    ProviderModelList->>ModelStore: Refresh custom models
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review ModelConfigDialog.vue closely for create vs edit control flow, identity validation, rename handling, and store interactions.
  • Verify ProviderModelList.vue state cleanup and event wiring for dialog open/refresh.
  • Confirm i18n keys are accurate across locales and watcher immediate changes have intended timing.

Possibly related PRs

Suggested labels

codex

Poem

🐰 A dialog blooms where inline once lay,
Name and id hop in, validated today,
Watchers wake early to fetch their fare,
Translations whisper names everywhere,
I nibble bugs and cheer — modal made with care!

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat: better custom model provider' is vague and doesn't clearly communicate the main change, which is refactoring custom model creation from inline forms to a modal dialog flow. Consider revising to something more specific like 'feat: refactor custom model creation to use modal dialog' or 'feat: extract custom model form to ModelConfigDialog' to better reflect the primary architectural change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/better-custom-model-form

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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/settings/ModelConfigDialog.vue (1)

701-759: Add error handling and user feedback for save failures.

The handleSave function has a try-catch that logs errors but provides no user-facing feedback. Users won't know if the save failed due to a network error, validation issue, or other problem.

Consider adding toast notifications for different error scenarios:

   } catch (error) {
     console.error('Failed to save model config:', error)
+    // Add user-facing error notification
+    // Example: toast.error(t('settings.model.modelConfig.saveFailed'))
+    // Consider different messages for different error types:
+    // - Network errors
+    // - Validation errors
+    // - Permission errors
   }

Additionally, consider preventing the dialog from closing on error by removing or conditionalizing the emit('update:open', false) in the error case.

🧹 Nitpick comments (8)
src/renderer/src/components/chat-input/composables/useMentionData.ts (1)

62-64: Consider aligning watcher options for MCP arrays

The MCP resources, tools, and prompts watchers now use { immediate: true } while selectedFiles uses { deep: true, immediate: true }. If these store arrays are ever mutated in place (push/splice) rather than replaced wholesale, these watchers will not re-run.

If the store does mutate arrays in place, consider making the options consistent:

-    },
-    { immediate: true }
+    },
+    { deep: true, immediate: true }

Apply similarly to the tools and prompts watchers if that matches how the Pinia store updates those collections.

Also applies to: 84-86, 106-107

src/renderer/src/i18n/pt-BR/settings.json (1)

144-160: Localize new modelConfig strings for pt-BR

The new model.modelConfig.name / id texts and createTitle / editTitle are left in English in a pt-BR locale, while surrounding entries are Portuguese. Consider adding proper pt-BR translations here (and keeping wording aligned with en-US) to avoid a mixed-language UI. Based on learnings, this also preserves a consistent key structure across locales.

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

144-160: Translate new modelConfig strings for ko-KR

model.modelConfig.name / id and createTitle / editTitle are still in English in the ko-KR file, whereas adjacent content is Korean. To keep the UI coherent, please provide Korean translations for these values while keeping semantics aligned with the en-US source.

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

144-160: Localize model identity fields in ja-JP

The newly added model.modelConfig.name / id blocks and createTitle / editTitle remain in English in this Japanese locale. For a consistent localized experience, translate these strings to Japanese while mirroring the meaning of the en-US originals.

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

144-160: Translate new custom-model strings for fa-IR

The new model.modelConfig.name / id texts and createTitle / editTitle are copied from en-US and not localized into Persian. To avoid a mixed-language UI, consider providing fa-IR translations for these values while preserving the same placeholders and meaning.

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

144-160: Localize new modelConfig identity strings in fr-FR

model.modelConfig.name / id plus createTitle / editTitle are still in English in this French locale. For consistency with the rest of fr-FR, please translate these values to French, keeping placeholders and semantics aligned with the en-US source.

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

174-179: Add error handling for custom model refresh.

The refreshCustomModels call lacks error handling. If the refresh fails, the user won't see the newly created model and won't receive feedback about the failure.

Apply this diff to add error handling:

 const handleAddModelSaved = async () => {
-  if (primaryProviderId.value) {
-    await modelStore.refreshCustomModels(primaryProviderId.value)
+  try {
+    if (primaryProviderId.value) {
+      await modelStore.refreshCustomModels(primaryProviderId.value)
+    }
+    emit('config-changed')
+  } catch (error) {
+    console.error('Failed to refresh custom models:', error)
+    // Consider adding user-facing toast notification here
   }
-  emit('config-changed')
 }

89-98: Consider using v-show instead of v-if for the dialog.

Using v-if="primaryProviderId" causes the dialog to be destroyed and recreated. Since the dialog is controlled by showAddModelDialog, using v-show would be more efficient and preserve component state during hide/show cycles.

     <ModelConfigDialog
-      v-if="primaryProviderId"
+      v-show="primaryProviderId"
       v-model:open="showAddModelDialog"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23a3e14 and 07bb2c1.

📒 Files selected for processing (14)
  • src/renderer/settings/components/ProviderModelList.vue (4 hunks)
  • src/renderer/src/components/chat-input/composables/useMentionData.ts (4 hunks)
  • src/renderer/src/components/settings/ModelConfigDialog.vue (9 hunks)
  • src/renderer/src/components/settings/ModelConfigItem.vue (1 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/pt-BR/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 (25)
src/renderer/src/i18n/**/*.json

📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)

src/renderer/src/i18n/**/*.json: Translation key naming convention: use dot-separated hierarchical structure with lowercase letters and descriptive names (e.g., 'common.button.submit')
Maintain consistent key-value structure across all language translation files (zh-CN, en-US, ko-KR, ru-RU, zh-HK, fr-FR, fa-IR)

Files:

  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/fa-IR/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/fr-FR/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
src/**/*

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

New features should be developed in the src directory

Files:

  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/fa-IR/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/components/settings/ModelConfigDialog.vue
  • src/renderer/settings/components/ProviderModelList.vue
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/renderer/**

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

Use lowercase with dashes for directories (e.g., components/auth-wizard)

Files:

  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/fa-IR/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/components/settings/ModelConfigDialog.vue
  • src/renderer/settings/components/ProviderModelList.vue
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/components/settings/ModelConfigItem.vue
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/settings/components/ProviderModelList.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Enable and maintain strict TypeScript type checking for all files

**/*.{ts,tsx}: Always use try-catch to handle possible errors in TypeScript code
Provide meaningful error messages when catching errors
Log detailed error logs including error details, context, and stack traces
Distinguish and handle different error types (UserError, NetworkError, SystemError, BusinessError) with appropriate handlers in TypeScript
Use structured logging with logger.error(), logger.warn(), logger.info(), logger.debug() methods from logging utilities
Do not suppress errors (avoid empty catch blocks or silently ignoring errors)
Provide user-friendly error messages for user-facing errors in TypeScript components
Implement error retry mechanisms for transient failures in TypeScript
Avoid logging sensitive information (passwords, tokens, PII) in logs

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
src/renderer/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Use the usePresenter.ts composable for renderer-to-main IPC communication to call presenter methods directly

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Do not include AI co-authoring information (e.g., 'Co-Authored-By: Claude') in git commits

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
**/*.{js,ts,jsx,tsx,mjs,cjs}

📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)

Write logs and comments in English

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
{src/main/presenter/**/*.ts,src/renderer/**/*.ts}

📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)

Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
src/renderer/src/**/*.{vue,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)

src/renderer/src/**/*.{vue,ts,tsx}: All user-facing strings must use i18n keys with vue-i18n framework in the renderer
Import and use useI18n() composable with the t() function to access translations in Vue components and TypeScript files
Use the dynamic locale.value property to switch languages at runtime
Avoid hardcoding user-facing text and ensure all user-visible text uses the i18n translation system

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/renderer/**/*.{vue,js,ts}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Renderer process code should be placed in src/renderer (Vue 3 application)

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/settings/components/ProviderModelList.vue
  • src/renderer/src/components/settings/ModelConfigItem.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 in Vue.js applications
Implement proper state management with Pinia in Vue.js applications
Utilize Vue Router for navigation and route management in Vue.js applications
Leverage Vue's built-in reactivity system for efficient data handling

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/renderer/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,tsx,vue}: Write concise, technical TypeScript code with accurate examples
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
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

Vue 3 app code in src/renderer/src should be organized into components/, stores/, views/, i18n/, lib/ directories with shell UI in src/renderer/shell/

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/settings/components/ProviderModelList.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/renderer/**/composables/*.ts

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/composables/*.ts: Use camelCase for composables (e.g., useAuthState.ts)
Use VueUse for common composables and utility functions
Implement custom composables for reusable logic

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

Use TypeScript for all code; prefer types over interfaces

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
src/renderer/**/*.{ts,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching
Leverage ref, reactive, and computed for reactive state management
Use provide/inject for dependency injection when appropriate
Use Iconify/Vue for icon implementation

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/settings/components/ProviderModelList.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/renderer/src/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

src/renderer/src/**/*.{ts,tsx,vue}: Use TypeScript with Vue 3 Composition API for the renderer application
All user-facing strings must use vue-i18n keys in src/renderer/src/i18n

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/**/*.{ts,tsx,vue,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier with single quotes, no semicolons, and 100 character width

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/settings/components/ProviderModelList.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use OxLint for linting JavaScript and TypeScript files

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.{ts,tsx}: Use camelCase for variable and function names in TypeScript files
Use PascalCase for type and class names in TypeScript
Use SCREAMING_SNAKE_CASE for constant names

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use EventBus for inter-process communication events

Files:

  • src/renderer/src/components/chat-input/composables/useMentionData.ts
**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.vue: Use Vue 3 Composition API for all components instead of Options API
Use Tailwind CSS with scoped styles for component styling

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/settings/components/ProviderModelList.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/renderer/**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

src/renderer/**/*.vue: All user-facing strings must use i18n keys via vue-i18n for internationalization
Ensure proper error handling and loading states in all UI components
Implement responsive design using Tailwind CSS utilities for all UI components

src/renderer/**/*.vue: Use composition API and declarative programming patterns; avoid options API
Structure files: exported component, composables, helpers, static content, types
Use PascalCase for component names (e.g., AuthWizard.vue)
Use Vue 3 with TypeScript, leveraging defineComponent and PropType
Use template syntax for declarative rendering
Use Shadcn Vue, Radix Vue, and Tailwind for components and styling
Implement responsive design with Tailwind CSS; use a mobile-first approach
Use Suspense for asynchronous components
Use <script setup> syntax for concise component definitions
Prefer 'lucide:' icon family as the primary choice for Iconify icons
Import Icon component from '@iconify/vue' and use with lucide icons following pattern '{collection}:{icon-name}'

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/settings/components/ProviderModelList.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/renderer/src/**/*.vue

📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)

Use scoped styles to prevent CSS conflicts between Vue components

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
src/renderer/src/components/**/*.vue

📄 CodeRabbit inference engine (AGENTS.md)

src/renderer/src/components/**/*.vue: Use Tailwind for styles in Vue components
Vue component files must use PascalCase naming (e.g., ChatInput.vue)

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
  • src/renderer/src/components/settings/ModelConfigItem.vue
🧠 Learnings (19)
📚 Learning: 2025-11-25T05:26:43.498Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.498Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Maintain consistent key-value structure across all language translation files (zh-CN, en-US, ko-KR, ru-RU, zh-HK, fr-FR, fa-IR)

Applied to files:

  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/fa-IR/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/fr-FR/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
📚 Learning: 2025-11-25T05:26:43.498Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.498Z
Learning: Applies to src/renderer/src/i18n/**/*.json : Translation key naming convention: use dot-separated hierarchical structure with lowercase letters and descriptive names (e.g., 'common.button.submit')

Applied to files:

  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/pt-BR/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/fa-IR/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/fr-FR/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
📚 Learning: 2025-11-25T05:26:43.498Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.498Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Avoid hardcoding user-facing text and ensure all user-visible text uses the i18n translation system

Applied to files:

  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
📚 Learning: 2025-11-25T05:26:43.498Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.498Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : All user-facing strings must use i18n keys with vue-i18n framework in the renderer

Applied to files:

  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
📚 Learning: 2025-11-25T05:26:11.297Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.297Z
Learning: Applies to src/renderer/**/*.vue : All user-facing strings must use i18n keys via vue-i18n for internationalization

Applied to files:

  • src/renderer/src/i18n/zh-HK/settings.json
📚 Learning: 2025-11-25T05:28:20.500Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.500Z
Learning: Applies to src/renderer/src/**/*.{ts,tsx,vue} : All user-facing strings must use vue-i18n keys in `src/renderer/src/i18n`

Applied to files:

  • src/renderer/src/i18n/zh-HK/settings.json
📚 Learning: 2025-11-25T05:26:11.297Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.297Z
Learning: Applies to **/*.{ts,tsx,js,jsx,vue} : Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)

Applied to files:

  • src/renderer/src/i18n/zh-HK/settings.json
📚 Learning: 2025-11-25T05:28:04.439Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.439Z
Learning: Applies to src/renderer/**/stores/*.ts : Use Pinia for state management

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:28:20.500Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.500Z
Learning: Applies to src/renderer/src/stores/**/*.ts : Use Pinia for state management

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Keep Pinia stores focused on global state, not component-specific data

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:45.535Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:45.535Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Implement proper state management with Pinia in Vue.js applications

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use modules to organize related state and actions in Pinia stores

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions in Pinia stores

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use getters for computed state properties in Pinia stores

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Utilize actions for side effects and asynchronous operations in Pinia stores

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:28:04.440Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.440Z
Learning: Applies to src/renderer/**/*.{ts,vue} : Leverage ref, reactive, and computed for reactive state management

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:26:43.498Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.498Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Import and use useI18n() composable with the t() function to access translations in Vue components and TypeScript files

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:26:11.297Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.297Z
Learning: Applies to src/main/presenter/configPresenter/**/*.ts : Store and retrieve custom prompts via `configPresenter.getCustomPrompts()` for config-based data source management

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:12.201Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-11-25T05:27:12.201Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : In Provider implementations, include helper methods for Provider-specific operations such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt`

Applied to files:

  • src/renderer/settings/components/ProviderModelList.vue
⏰ 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)
  • GitHub Check: build-check (x64)
🔇 Additional comments (11)
src/renderer/src/components/chat-input/composables/useMentionData.ts (1)

26-41: Immediate watcher for selectedFiles looks good

Using { deep: true, immediate: true } here fits the need to both react to in-place mutations on selectedFiles.value and pre-populate mentionData on setup. No issues from a reactivity/timing perspective.

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

144-160: Model identity translations look consistent

model.modelConfig.name / id plus createTitle / editTitle are added with proper zh-HK translations and match the structure used in other locales. No changes needed.

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

144-160: Canonical identity/validation strings look good

The added model.modelConfig.name / id fields and createTitle / editTitle are clear, consistent, and provide the right hooks for validation (especially id.duplicate). This is a solid base for other locales to mirror.

src/renderer/src/components/settings/ModelConfigItem.vue (1)

72-81: Verification complete: ModelConfigDialog prop types are in sync

The props passed from ModelConfigItem.vue (mode="edit", :is-custom-model="isCustomModel") match the declared types in ModelConfigDialog.vue exactly:

  • mode?: 'create' | 'edit' (line 461, defaulting to 'edit')
  • isCustomModel?: boolean (line 462, defaulting to false)

All other required props (open, modelId, modelName, providerId) are also correctly typed and passed. No changes needed.

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

140-160: LGTM! i18n keys properly structured.

The new modelConfig identity field keys (name, id, createTitle, editTitle) follow the dot-separated hierarchical naming convention and provide comprehensive field-level translations for the enhanced model configuration dialog.

Based on learnings and coding guidelines for i18n structure.

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

144-160: LGTM! Consistent i18n structure maintained.

The zh-TW translations maintain the same key-value structure as zh-CN with appropriate Traditional Chinese translations.

Based on learnings requiring consistent key-value structure across all language files.

src/renderer/src/components/settings/ModelConfigDialog.vue (4)

461-468: LGTM! Props and defaults properly defined.

The new mode and isCustomModel props with defaults enable the create/edit workflow while maintaining backward compatibility.


649-668: Identity validation logic is sound.

The validation correctly:

  • Checks for empty name and ID when required
  • Excludes the original ID when checking for duplicates in edit mode
  • Applies validation only when shouldValidateIdentity is true

14-57: Identity field UI properly implements readonly/editable states.

The template correctly:

  • Binds to modelNameField and modelIdField refs
  • Disables fields when identity can't be edited
  • Shows different descriptive text based on editability
  • Displays per-field validation errors

767-784: Reset behavior correctly handles create vs edit modes.

In create mode, the reset properly clears identity fields and config. In edit mode, it reloads from the store. This maintains expected user behavior for both scenarios.

src/renderer/settings/components/ProviderModelList.vue (1)

129-129: Clarify that primaryProviderId refers to a single provider (always providers[0]), document the assumption, or rename for clarity.

The assumption that providers[0] is "primary" currently holds because ProviderDialogContainer passes only a single-element array: [{ id: provider.id, name: provider.name }]. However, the semantic intent is unclear—the variable suggests a designated "primary" provider, when it actually refers to whichever provider is at index [0]. If ProviderModelList is reused elsewhere with multiple providers or if the providers array is reordered, this will break. Add a comment explaining that only one provider is expected, or rename to selectedProviderId for clarity.

Comment on lines +708 to +752
if (isCreateMode.value) {
await modelStore.addCustomModel(
props.providerId,
buildCustomModelPayload(trimmedId, trimmedName, true)
)
await modelConfigStore.setModelConfig(trimmedId, props.providerId, config.value)
} else if (props.isCustomModel) {
if (!props.modelId) return
const previousId = originalModelId.value
const enabledState = currentCustomModel.value?.enabled ?? true
if (trimmedId !== previousId) {
if (previousId) {
try {
await modelConfigStore.resetModelConfig(previousId, props.providerId)
} catch (resetError) {
console.warn('Failed to reset previous model config:', resetError)
}
await modelStore.removeCustomModel(props.providerId, previousId)
}
await modelStore.addCustomModel(
props.providerId,
buildCustomModelPayload(trimmedId, trimmedName, enabledState)
)
if (!enabledState) {
await modelStore.updateModelStatus(props.providerId, trimmedId, false)
}
} else {
await modelStore.updateCustomModel(props.providerId, trimmedId, {
name: trimmedName,
contextLength: config.value.contextLength,
maxTokens: config.value.maxTokens,
vision: config.value.vision,
functionCall: config.value.functionCall,
reasoning: config.value.reasoning,
enableSearch: config.value.enableSearch,
type: config.value.type ?? ModelType.Chat
})
}
await modelConfigStore.setModelConfig(trimmedId, props.providerId, config.value)
} else {
if (!props.modelId) return
await modelConfigStore.setModelConfig(props.modelId, props.providerId, config.value)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Verify transactional integrity in custom model update flows.

The save logic for custom models with ID changes performs multiple async operations (reset old config, remove old model, add new model, update status, set config). If any intermediate step fails, the state could become inconsistent with partial changes applied.

Consider wrapping related operations in a transaction or implementing rollback logic. Verify that the model store and config store handle partial failures gracefully:

As per Vue best practices for state management with Pinia.


🏁 Script executed:

#!/bin/bash
# Search for transaction or rollback patterns in stores
rg -n --type ts -C5 'addCustomModel|removeCustomModel|updateCustomModel' src/renderer/src/stores/

Length of output: 8381


I need to examine the modelConfigStore to understand how resetModelConfig and setModelConfig handle errors, and whether there's any transaction or rollback pattern implemented.

Now let me search for the modelConfigStore implementation to understand the full picture:

Let me search for the modelConfigStore implementation directly:


🏁 Script executed:

#!/bin/bash
# Find modelConfigStore file
fd -t f 'modelConfig.*' src/renderer/src/stores/ --exec grep -l 'resetModelConfig\|setModelConfig' {} \;

Length of output: 43


🏁 Script executed:

#!/bin/bash
# Extract resetModelConfig and setModelConfig methods from modelConfigStore
rg -n --type ts -A20 'const resetModelConfig|const setModelConfig|resetModelConfig\s*=' src/renderer/src/stores/modelConfigStore.ts | head -100

Length of output: 1005


Implement rollback/compensating transaction logic for custom model ID changes.

The transactional integrity concern is verified as valid. The component's save flow (lines 708-752) executes multiple dependent async operations without compensating transaction logic:

  1. resetModelConfig (line 717) and setModelConfig (line 746) have no error handling
  2. If removeCustomModel (line 721) succeeds but addCustomModel (line 723) fails, the model is deleted without replacement
  3. If addCustomModel succeeds but updateModelStatus (line 725) or setModelConfig (line 746) fails, state becomes inconsistent

Neither modelStore.ts nor modelConfigStore.ts implements rollback logic. For the ID change flow, wrap the operation sequence in try-catch with compensating actions: if any step fails, restore or remove intermediate changes (e.g., re-add the removed model, restore the old cache entry).

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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/settings/ModelConfigDialog.vue (1)

481-494: LGTM: Centralized default configuration.

Extracting createDefaultConfig into a dedicated function improves maintainability by consolidating default values in one location, eliminating duplication.

♻️ Duplicate comments (2)
src/renderer/src/components/settings/ModelConfigDialog.vue (2)

542-554: Duplicate detection normalization already implemented.

The exclusion check now properly normalizes excludeId (line 546) before comparison (line 551), addressing the concern raised in the previous review about case/whitespace variations.


710-750: Transactional integrity concern remains unaddressed.

The save flow for custom models with ID changes (lines 721-737) still performs multiple async operations without rollback logic:

  1. resetModelConfig (line 724) - if this succeeds but later steps fail, the old config is lost
  2. removeCustomModel (line 728) - if this succeeds but addCustomModel (line 730) fails, the model is deleted without replacement
  3. updateModelStatus (line 735) - if this fails after add, status becomes inconsistent

If any intermediate step fails, the state becomes partially updated with no recovery mechanism. The top-level try-catch (line 709) only logs the error without rollback.

Consider implementing compensating transactions:

// Pseudo-code for safer ID change flow
if (trimmedId !== previousId) {
  const snapshot = { id: previousId, config: await getConfig(...), model: currentCustomModel.value }
  try {
    await modelStore.removeCustomModel(props.providerId, previousId)
    await modelStore.addCustomModel(props.providerId, buildCustomModelPayload(...))
    await modelStore.updateModelStatus(...)
    await modelConfigStore.setModelConfig(...)
  } catch (error) {
    // Rollback: restore removed model, reset config
    await modelStore.addCustomModel(props.providerId, snapshot.model)
    await modelConfigStore.setModelConfig(snapshot.id, props.providerId, snapshot.config)
    throw error
  }
}

As per Vue best practices for state management with Pinia.

🧹 Nitpick comments (1)
src/renderer/src/components/settings/ModelConfigDialog.vue (1)

868-874: Consider removing redundant fetchCapabilities watcher.

The watcher at lines 868-874 triggers fetchCapabilities when the dialog opens, but loadConfig (triggered by the watcher at lines 789-797) already calls fetchCapabilities at lines 590 and 604. This causes fetchCapabilities to run twice when the dialog opens.

While this is idempotent and not harmful, removing the second watcher would eliminate redundant API calls.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 07bb2c1 and def9cf6.

📒 Files selected for processing (2)
  • src/renderer/src/components/settings/ModelConfigDialog.vue (9 hunks)
  • src/renderer/src/i18n/ru-RU/settings.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/i18n/ru-RU/settings.json
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.vue: Use Vue 3 Composition API for all components instead of Options API
Use Tailwind CSS with scoped styles for component styling

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
src/renderer/**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

src/renderer/**/*.vue: All user-facing strings must use i18n keys via vue-i18n for internationalization
Ensure proper error handling and loading states in all UI components
Implement responsive design using Tailwind CSS utilities for all UI components

src/renderer/**/*.vue: Use composition API and declarative programming patterns; avoid options API
Structure files: exported component, composables, helpers, static content, types
Use PascalCase for component names (e.g., AuthWizard.vue)
Use Vue 3 with TypeScript, leveraging defineComponent and PropType
Use template syntax for declarative rendering
Use Shadcn Vue, Radix Vue, and Tailwind for components and styling
Implement responsive design with Tailwind CSS; use a mobile-first approach
Use Suspense for asynchronous components
Use <script setup> syntax for concise component definitions
Prefer 'lucide:' icon family as the primary choice for Iconify icons
Import Icon component from '@iconify/vue' and use with lucide icons following pattern '{collection}:{icon-name}'

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
src/renderer/src/**/*.{vue,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)

src/renderer/src/**/*.{vue,ts,tsx}: All user-facing strings must use i18n keys with vue-i18n framework in the renderer
Import and use useI18n() composable with the t() function to access translations in Vue components and TypeScript files
Use the dynamic locale.value property to switch languages at runtime
Avoid hardcoding user-facing text and ensure all user-visible text uses the i18n translation system

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
src/**/*

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

New features should be developed in the src directory

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
src/renderer/**/*.{vue,js,ts}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Renderer process code should be placed in src/renderer (Vue 3 application)

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 in Vue.js applications
Implement proper state management with Pinia in Vue.js applications
Utilize Vue Router for navigation and route management in Vue.js applications
Leverage Vue's built-in reactivity system for efficient data handling

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
src/renderer/src/**/*.vue

📄 CodeRabbit inference engine (.cursor/rules/vue-best-practices.mdc)

Use scoped styles to prevent CSS conflicts between Vue components

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}: Write concise, technical TypeScript code with accurate examples
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
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

Vue 3 app code in src/renderer/src should be organized into components/, stores/, views/, i18n/, lib/ directories with shell UI in src/renderer/shell/

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
src/renderer/**

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

Use lowercase with dashes for directories (e.g., components/auth-wizard)

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
Leverage ref, reactive, and computed for reactive state management
Use provide/inject for dependency injection when appropriate
Use Iconify/Vue for icon implementation

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
src/renderer/src/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

src/renderer/src/**/*.{ts,tsx,vue}: Use TypeScript with Vue 3 Composition API for the renderer application
All user-facing strings must use vue-i18n keys in src/renderer/src/i18n

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
src/renderer/src/components/**/*.vue

📄 CodeRabbit inference engine (AGENTS.md)

src/renderer/src/components/**/*.vue: Use Tailwind for styles in Vue components
Vue component files must use PascalCase naming (e.g., ChatInput.vue)

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
src/**/*.{ts,tsx,vue,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier with single quotes, no semicolons, and 100 character width

Files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
🧠 Learnings (11)
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Implement proper state persistence for maintaining data across sessions in Pinia stores

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Utilize actions for side effects and asynchronous operations in Pinia stores

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:28:04.439Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.439Z
Learning: Applies to src/renderer/**/stores/*.ts : Use Pinia for state management

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:28:20.500Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.500Z
Learning: Applies to src/renderer/src/stores/**/*.ts : Use Pinia for state management

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Keep Pinia stores focused on global state, not component-specific data

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:45.535Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:45.535Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Implement proper state management with Pinia in Vue.js applications

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use modules to organize related state and actions in Pinia stores

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:27:20.058Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:20.058Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Use getters for computed state properties in Pinia stores

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:28:04.440Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.440Z
Learning: Applies to src/renderer/**/*.{ts,vue} : Leverage ref, reactive, and computed for reactive state management

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:26:43.498Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-11-25T05:26:43.498Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Import and use useI18n() composable with the t() function to access translations in Vue components and TypeScript files

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
📚 Learning: 2025-11-25T05:26:11.297Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.297Z
Learning: Applies to src/main/presenter/configPresenter/**/*.ts : Store and retrieve custom prompts via `configPresenter.getCustomPrompts()` for config-based data source management

Applied to files:

  • src/renderer/src/components/settings/ModelConfigDialog.vue
⏰ 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)
  • GitHub Check: build-check (x64)
🔇 Additional comments (8)
src/renderer/src/components/settings/ModelConfigDialog.vue (8)

461-468: LGTM: Props and defaults properly defined.

The new mode and isCustomModel props are well-typed and have sensible defaults (mode: 'edit', isCustomModel: false). This provides backward compatibility while enabling the new create flow.


498-510: LGTM: Identity field initialization and computed logic.

The identity field refs and computed properties are well-structured:

  • isCreateMode, canEditModelIdentity, and shouldValidateIdentity derive correctly from props
  • dialogTitle uses i18n with proper interpolation for dynamic names
  • Reactive patterns follow Vue 3 best practices

556-567: LGTM: Clean helper for custom model payload construction.

The buildCustomModelPayload function centralizes the logic for building custom model objects, improving code readability and maintainability in the save flow.


569-580: LGTM: Mode-aware identity field initialization.

The initializeIdentityFields function correctly handles both create and edit modes, clearing fields for create mode and populating from props for edit mode.


651-670: LGTM: Robust identity field validation.

The identity validation logic is well-implemented:

  • Correctly gated by shouldValidateIdentity for create/custom modes only
  • Checks for empty modelName and modelId with appropriate i18n error messages
  • Duplicate detection excludes the original ID in edit mode and only runs when the ID changes
  • Validation follows defensive programming practices

771-777: LGTM: Mode-aware reset behavior.

The reset logic properly handles create mode by resetting config to defaults and clearing identity fields, while preserving existing edit mode behavior. This provides a clean user experience for both flows.


525-540: LGTM: Provider model list computed properties.

The computed properties for providerCustomModelList, providerStandardModelList, and currentCustomModel are well-structured with proper null checks and filtering logic.


906-944: LGTM: Mutual exclusive toggle logic.

The implementation of mutual exclusive toggles for reasoning and functionCall features correctly handles the DeepSeek V3.1 model constraints with proper user confirmation flow before disabling the opposite feature.


<div class="overflow-y-auto flex-1 pr-2 -mr-2">
<form @submit.prevent="handleSave" class="space-y-6">
<!-- 模型名称 -->
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Replace Chinese comments with English.

Lines 13 and 36 contain Chinese comments ("模型名称" and "模型 ID"), which violates the coding guideline requiring English for all comments in TypeScript/JavaScript/Vue files.

Apply this diff to use English comments:

-          <!-- 模型名称 -->
+          <!-- Model Name -->
           <div class="space-y-2">
-          <!-- 模型 ID -->
+          <!-- Model ID -->
           <div class="space-y-2">

As per coding guidelines.

Also applies to: 36-36

🤖 Prompt for AI Agents
In src/renderer/src/components/settings/ModelConfigDialog.vue around lines 13
and 36, replace the Chinese inline comments "模型名称" and "模型 ID" with English
comments "Model Name" and "Model ID" respectively; make only the comment text
changes (no code logic changes) and keep comment style consistent with
surrounding file.

Comment on lines +588 to +592
if (isCreateMode.value) {
config.value = createDefaultConfig()
await fetchCapabilities()
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify capability fetching in create mode with empty modelId.

In create mode (lines 588-592), fetchCapabilities is called, but modelIdField is empty at this point (cleared by initializeIdentityFields). The fetchCapabilities function checks props.modelId (line 831), which will be empty in create mode, causing capabilities to be set to null.

This may be intentional (create mode starts with no capabilities), but if custom models should inherit provider-level defaults, this logic needs adjustment.


🏁 Script executed:

#!/bin/bash
# Search for how fetchCapabilities is expected to behave with empty modelId
rg -n -C5 'fetchCapabilities|supportsReasoningCapability' src/renderer/src --type ts

Length of output: 3352



🏁 Script executed:

#!/bin/bash
# Get loadConfig function context and understand the flow
sed -n '583,650p' src/renderer/src/components/settings/ModelConfigDialog.vue

Length of output: 2254


🏁 Script executed:

#!/bin/bash
# Check how modelIdField is managed and when user can enter it
rg -n -B5 -A5 'modelIdField|initializeIdentityFields' src/renderer/src/components/settings/ModelConfigDialog.vue | head -80

Length of output: 2498


🏁 Script executed:

#!/bin/bash
# Check if there's anything special about the create mode flow after loadConfig
rg -n 'create-mode|isCreateMode' src/renderer/src/components/settings/ModelConfigDialog.vue | head -20

Length of output: 581


Remove or clarify the redundant fetchCapabilities() call in create mode.

The explicit fetchCapabilities() call at line 590 is ineffective in create mode because modelIdField is empty (cleared by initializeIdentityFields at line 586). The function returns early when modelId is empty (see useModelCapabilities.ts line 62-65), so capabilities are simply reset to null.

The watcher in useModelCapabilities.ts (line 89) automatically triggers fetchCapabilities() when the user later populates the modelId field. Either remove the explicit call or document this is intentional reset behavior. Recommend removing it for clarity:

if (isCreateMode.value) {
  config.value = createDefaultConfig()
  return
}
🤖 Prompt for AI Agents
In src/renderer/src/components/settings/ModelConfigDialog.vue around lines
588-592, the explicit fetchCapabilities() call in create mode is redundant
because initializeIdentityFields clears modelIdField just before it so
fetchCapabilities() returns early and only resets capabilities to null; remove
the fetchCapabilities() call (or, if the intent is to explicitly reset
capabilities, add a comment clarifying that behavior) so the code becomes: set
config.value = createDefaultConfig() and return, relying on the watcher in
useModelCapabilities.ts to fetch capabilities when the user later populates
modelId.

@zerob13 zerob13 merged commit 014bf0d into dev Nov 25, 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