Skip to content

Conversation

yyhhyyyyyy
Copy link
Collaborator

@yyhhyyyyyy yyhhyyyyyy commented Aug 15, 2025

add search functionality for provider settings
image

Summary by CodeRabbit

  • New Features
    • Debounced search/filter in Provider Settings to find platforms by name, ID, or type; shows a clear button and supports Esc to reset. Filtering applies to both enabled and disabled provider lists.
  • Chores
    • Added localized placeholder/label for the provider search across multiple languages (en, fa, fr, ja, ko, ru, zh-CN, zh-HK, zh-TW).

Copy link
Contributor

coderabbitai bot commented Aug 15, 2025

Walkthrough

Adds a debounced client-side search/filter UI to ModelProviderSettings.vue and introduces a new i18n key provider.search across multiple locales. Provider lists (enabled/disabled) are derived from sortedProviders, filtered by the search query, and enabling still scrolls the item into view.

Changes

Cohort / File(s) Summary
Provider settings UI
src/renderer/src/components/settings/ModelProviderSettings.vue
Adds a debounced search input (bound via searchQueryBasesearchQuery using refDebounced), clear/ESC behavior, filterProviders function, allEnabledProviders/allDisabledProviders derived lists, applies filtering to both groups, and updates setters to merge with the opposite group. Preserves drag-and-drop, toggle behavior, and post-enable scroll-into-view.
Localization: provider.search
src/renderer/src/i18n/*/settings.json
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
Adds provider.search translation string (search placeholder/label) in each listed locale. No other keys or logic changed.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant M as ModelProviderSettings.vue
  participant S as settingsStore

  U->>M: Type in search box
  M->>M: Debounce input -> update searchQuery
  M->>M: filterProviders(allEnabledProviders/allDisabledProviders)
  M-->>U: Render filtered enabled/disabled lists

  U->>M: Toggle enable/disable provider
  M->>S: Update provider lists (merge with opposite group)
  S-->>M: sortedProviders updated
  M->>M: nextTick -> scroll enabled provider into view
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • zerob13

Poem

A whisk of keys, a search appears— hop!
I sift through clouds of providers—pop!
Enable, disable, shuffle in view,
A carrot-colored cursor, filtering true.
With every bounce and tidy sort, I find my platform—short report. 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 52c7dee and 91db911.

📒 Files selected for processing (1)
  • src/renderer/src/components/settings/ModelProviderSettings.vue (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/settings/ModelProviderSettings.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)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/provider-search-box

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

🧹 Nitpick comments (11)
src/renderer/src/i18n/ru-RU/settings.json (1)

228-228: Unify RU terminology with the rest of the file (“поставщик услуг” vs “провайдер”).

Elsewhere we use “Поставщик услуг”. For consistency, prefer “поставщиков услуг”.

-    "search": "Поиск платформ провайдеров…",
+    "search": "Поиск платформ поставщиков услуг…",
src/renderer/src/i18n/ja-JP/settings.json (1)

228-228: Align JP wording with existing “サービスプロバイダー” terminology.

Most strings use “サービスプロバイダー”. Consider simplifying and aligning:

-    "search": "プロバイダープラットフォームを検索…",
+    "search": "サービスプロバイダーを検索…",
src/renderer/src/i18n/ko-KR/settings.json (1)

228-228: Use the same KR term used elsewhere (“서비스 제공 업체”) instead of mixing with “프로바이더”.

Keeps terminology consistent within this locale.

-    "search": "프로바이더 플랫폼 검색…",
+    "search": "서비스 제공 업체 검색…",
src/renderer/src/i18n/zh-TW/settings.json (1)

228-228: TW wording nit: drop “平台” for brevity and consistency.

Other keys refer to “服務提供者”; “平台” is redundant.

-    "search": "搜尋服務提供者平台…",
+    "search": "搜尋服務提供者…",
src/renderer/src/i18n/zh-CN/settings.json (1)

228-228: CN wording nit: drop “平台” to match existing “服务商” usage.

“搜索服务商…” reads cleaner and aligns with “服务商设置”.

-    "search": "搜索服务商平台…",
+    "search": "搜索服务商…",
src/renderer/src/components/settings/ModelProviderSettings.vue (5)

8-13: Minor UX: Mark as a search field, trim binding, and support Esc to clear

This improves semantics and UX without changing behavior. Trim avoids needless whitespace filtering.

-            <Input
-              v-model="searchQueryBase"
-              :placeholder="t('settings.provider.search')"
-              class="h-8 pr-8"
-            />
+            <Input
+              v-model.trim="searchQueryBase"
+              type="search"
+              :placeholder="t('settings.provider.search')"
+              class="h-8 pr-8"
+              @keydown.esc="clearSearch"
+            />

20-25: Use a button for the clear action for better accessibility

Clickable icons are not keyboard-focusable or announced by screen readers. Wrap the icon in a semantic button.

-            <Icon
-              v-else
-              icon="lucide:x"
-              class="absolute right-2 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground cursor-pointer hover:text-foreground"
-              @click="clearSearch"
-            />
+            <button
+              v-else
+              type="button"
+              class="absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring"
+              @click="clearSearch"
+            >
+              <Icon icon="lucide:x" class="w-4 h-4" />
+            </button>

Optionally add an i18n-backed aria-label/title for the button if a suitable key (e.g., common.clear) exists.


188-199: Locale-aware, case-insensitive matching

Use locale-aware toLocaleLowerCase() for better matching in non-English locales. It’s cheap and avoids corner cases with language-specific case folding.

-  const query = searchQuery.value.toLowerCase().trim()
+  const query = searchQuery.value.toLocaleLowerCase().trim()
   return providers.filter(
     (provider) =>
-      t(provider.name).toLowerCase().includes(query) ||
-      provider.id.toLowerCase().includes(query) ||
-      (provider.apiType && provider.apiType.toLowerCase().includes(query))
+      t(provider.name).toLocaleLowerCase().includes(query) ||
+      provider.id.toLocaleLowerCase().includes(query) ||
+      (provider.apiType && provider.apiType.toLocaleLowerCase().includes(query))
   )

5-26: Use English for comments per project guideline

Inline comments here are in Chinese. The repo guideline for .vue/.ts/.js files is to use English for logs and comments. Please translate these comments.


286-309: Type the drag move event instead of any

Avoid any and use typed events from vuedraggable to catch mistakes early.

You can add:

import type { MoveEvent } from 'vuedraggable'

Then update signatures:

const onMoveEnabled = (evt: MoveEvent<LLM_PROVIDER>) => { /* ... */ }
const onMoveDisabled = (evt: MoveEvent<LLM_PROVIDER>) => { /* ... */ }
src/renderer/src/i18n/en-US/settings.json (1)

228-228: Nit: Consider more concise wording

“Search providers…” reads more naturally in English than “Search provider platforms…”.

-    "search": "Search provider platforms…",
+    "search": "Search providers…",
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f1b9111 and 52c7dee.

📒 Files selected for processing (10)
  • src/renderer/src/components/settings/ModelProviderSettings.vue (4 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 (9)
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-HK/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/components/settings/ModelProviderSettings.vue
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Use English for logs and comments

Files:

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

📄 CodeRabbit Inference Engine (CLAUDE.md)

src/renderer/src/**/*.vue: Use Composition API for all Vue 3 components
Use Tailwind CSS with scoped styles for styling
Organize components by feature in src/renderer/src/
Follow existing component patterns in src/renderer/src/ when creating new UI components
Use Composition API with proper TypeScript typing for new UI components
Implement responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states for new UI components

Use scoped styles to prevent CSS conflicts between components

Files:

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

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

渲染进程代码放在 src/renderer

Files:

  • src/renderer/src/components/settings/ModelProviderSettings.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/ModelProviderSettings.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/ModelProviderSettings.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/ModelProviderSettings.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/ModelProviderSettings.vue
🧠 Learnings (5)
📚 Learning: 2025-07-21T01:46:30.354Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/common.json : Shared translation keys must be placed in 'src/renderer/src/i18n/common.json'

Applied to files:

  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
📚 Learning: 2025-07-23T00:45:57.322Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Leverage ref, reactive, and computed for reactive state management.

Applied to files:

  • src/renderer/src/components/settings/ModelProviderSettings.vue
📚 Learning: 2025-07-23T00:45:57.322Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Import Icon component from Iconify/Vue.

Applied to files:

  • src/renderer/src/components/settings/ModelProviderSettings.vue
📚 Learning: 2025-07-23T00:45:57.322Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/{composables,utils}/**/*.ts : Use VueUse for common composables and utility functions.

Applied to files:

  • src/renderer/src/components/settings/ModelProviderSettings.vue
📚 Learning: 2025-07-21T01:46:30.354Z
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/**/* : Use the 'vue-i18n' framework for all internationalization in the renderer

Applied to files:

  • src/renderer/src/components/settings/ModelProviderSettings.vue
🔇 Additional comments (5)
src/renderer/src/i18n/zh-CN/settings.json (1)

228-229: i18n: provider.search is present & used — no action required

Verified: the renderer uses the translation key and every locale's settings.json contains the provider.search entry (no hardcoded placeholder found).

  • Usage in renderer:
    • src/renderer/src/components/settings/ModelProviderSettings.vue — :placeholder="t('settings.provider.search')" (found at line 10)
  • Locales containing provider.search (search key at line ~228 in each file):
    • src/renderer/src/i18n/en-US/settings.json (line 228)
    • src/renderer/src/i18n/fa-IR/settings.json (line 228)
    • src/renderer/src/i18n/fr-FR/settings.json (line 228)
    • src/renderer/src/i18n/ja-JP/settings.json (line 228)
    • src/renderer/src/i18n/ko-KR/settings.json (line 228)
    • src/renderer/src/i18n/ru-RU/settings.json (line 228)
    • src/renderer/src/i18n/zh-CN/settings.json (line 228)
    • src/renderer/src/i18n/zh-HK/settings.json (line 228)
    • src/renderer/src/i18n/zh-TW/settings.json (line 228)

No changes required.

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

228-228: LGTM: i18n key added and correctly scoped

provider.search is added under settings.provider and is used in the UI placeholder. Looks consistent with existing terminology (“服務商”).

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

228-228: provider.search present in all settings locales — no missing keys

Checked settings.json files under src/renderer/src/i18n; the key provider.search exists in:

  • src/renderer/src/i18n/en-US/settings.json
  • src/renderer/src/i18n/fa-IR/settings.json
  • src/renderer/src/i18n/fr-FR/settings.json
  • src/renderer/src/i18n/ja-JP/settings.json
  • src/renderer/src/i18n/ko-KR/settings.json
  • src/renderer/src/i18n/ru-RU/settings.json
  • src/renderer/src/i18n/zh-CN/settings.json
  • src/renderer/src/i18n/zh-HK/settings.json
  • src/renderer/src/i18n/zh-TW/settings.json

Optional: if this label is reused across multiple settings panels, consider moving it to src/renderer/src/i18n/common.json per the shared-keys rule.

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

228-228: LGTM: Farsi translation added for the new key

The new provider.search entry is present and follows the established structure.

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

228-228: Confirm phrasing with a native speaker

“Rechercher des plateformes de fournisseurs…” is understandable but may be less idiomatic than “Rechercher des fournisseurs…”. Please verify the preferred phrasing.

@zerob13 zerob13 merged commit ae13c8a into dev Aug 15, 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