Skip to content

feat(web): add custom-model create hint and i18n translations - #3002

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
RedwindA:feat/zeroMatchHint
Feb 24, 2026
Merged

feat(web): add custom-model create hint and i18n translations#3002
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
RedwindA:feat/zeroMatchHint

Conversation

@RedwindA

@RedwindA RedwindA commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

PR 类型

  • Bug 修复
  • 新功能
  • 文档更新
  • 其他

PR 是否包含破坏性更新?

PR 描述

优化“模型下拉搜索”场景的防呆体验:当用户在下拉框中搜索不到模型时,明确提示可按回车将输入内容作为自定义模型名加入,降低误解和重复适配诉求。

Summary by CodeRabbit

Release Notes

  • New Features

    • Added model search functionality with real-time filtering in modals.
    • Displays contextual guidance when no matching models are found.
    • Supports creating custom model names when search yields no results.
  • Localization

    • Added translations for the model search feature across multiple languages (English, French, Japanese, Russian, Vietnamese, Chinese).

@coderabbitai

coderabbitai Bot commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adds client-side model search and custom model creation support to channel and tag modals. When a search query yields no matching models, users see a hint enabling them to create a custom model by pressing Enter. Corresponding translation strings for the no-matches hint are added across seven language locales.

Changes

Cohort / File(s) Summary
Modal Component Enhancements
web/src/components/table/channels/modals/EditChannelModal.jsx, web/src/components/table/channels/modals/EditTagModal.jsx
Introduce client-side model search state (modelSearchValue), computed match count and hint text, and reset search state on modal visibility changes. Model selection field now supports custom creation (allowCreate) and renders dynamic hint text in dropdown when no matches found.
Internationalization
web/src/i18n/locales/en.json, web/src/i18n/locales/fr.json, web/src/i18n/locales/ja.json, web/src/i18n/locales/ru.json, web/src/i18n/locales/vi.json, web/src/i18n/locales/zh-CN.json, web/src/i18n/locales/zh-TW.json
Add translation entries for the new no-matches hint message ("No matching models. Press Enter to add "{{name}}" as a custom model name.") across all supported languages.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • seefs001

Poem

🐰 A search so keen, through models we hop,
When matches are rare, the hints never stop!
"Press Enter," we say, with a customized gleam,
Making models from dreams—oh, what a fine scheme! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding a custom-model creation hint UI and internationalization translations across multiple locale files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web/src/components/table/channels/modals/EditChannelModal.jsx (1)

1041-1058: Redundant setModelSearchValue('') reset on modal close.

Line 1042 runs unconditionally on every [props.visible, channelId] change. When the modal closes, the else branch then calls resetModalState() (line 1056), which also calls setModelSearchValue('') at line 1097 — two identical state updates in the same render cycle.

Consider removing the one in resetModalState and keeping the unconditional reset here (or vice-versa), to avoid the duplication.

♻️ Option: consolidate into resetModalState only
 useEffect(() => {
-  setModelSearchValue('');
   if (props.visible) {
+    setModelSearchValue('');
     if (isEdit) {

This keeps the reset close to where the modal opens (intentional fresh state on each open), and the existing call in resetModalState handles the close case.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/components/table/channels/modals/EditChannelModal.jsx` around lines
1041 - 1058, The effect currently calls setModelSearchValue('') unconditionally
and resetModalState() also resets model search, causing duplicate state updates;
pick one place to perform the reset — e.g., remove the setModelSearchValue('')
call from the useEffect and keep the reset inside resetModalState (or
vice‑versa) so only one reset occurs when props.visible changes; update the
useEffect around props.visible/channelId and the resetModalState function to
ensure setModelSearchValue is invoked exactly once and remove the duplicate call
(references: useEffect, setModelSearchValue, resetModalState, props.visible,
channelId).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/src/components/table/channels/modals/EditChannelModal.jsx`:
- Around line 1041-1058: The effect currently calls setModelSearchValue('')
unconditionally and resetModalState() also resets model search, causing
duplicate state updates; pick one place to perform the reset — e.g., remove the
setModelSearchValue('') call from the useEffect and keep the reset inside
resetModalState (or vice‑versa) so only one reset occurs when props.visible
changes; update the useEffect around props.visible/channelId and the
resetModalState function to ensure setModelSearchValue is invoked exactly once
and remove the duplicate call (references: useEffect, setModelSearchValue,
resetModalState, props.visible, channelId).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c7e65c and 79e1daf.

📒 Files selected for processing (9)
  • web/src/components/table/channels/modals/EditChannelModal.jsx
  • web/src/components/table/channels/modals/EditTagModal.jsx
  • web/src/i18n/locales/en.json
  • web/src/i18n/locales/fr.json
  • web/src/i18n/locales/ja.json
  • web/src/i18n/locales/ru.json
  • web/src/i18n/locales/vi.json
  • web/src/i18n/locales/zh-CN.json
  • web/src/i18n/locales/zh-TW.json

@Calcium-Ion
Calcium-Ion merged commit aa9e0fe into QuantumNous:main Feb 24, 2026
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
feat(web): add custom-model create hint and i18n translations
@RedwindA
RedwindA deleted the feat/zeroMatchHint branch July 23, 2026 07:03
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