feat(web): add custom-model create hint and i18n translations - #3002
Conversation
WalkthroughThis 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/src/components/table/channels/modals/EditChannelModal.jsx (1)
1041-1058: RedundantsetModelSearchValue('')reset on modal close.Line 1042 runs unconditionally on every
[props.visible, channelId]change. When the modal closes, theelsebranch then callsresetModalState()(line 1056), which also callssetModelSearchValue('')at line 1097 — two identical state updates in the same render cycle.Consider removing the one in
resetModalStateand 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
resetModalStatehandles 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
📒 Files selected for processing (9)
web/src/components/table/channels/modals/EditChannelModal.jsxweb/src/components/table/channels/modals/EditTagModal.jsxweb/src/i18n/locales/en.jsonweb/src/i18n/locales/fr.jsonweb/src/i18n/locales/ja.jsonweb/src/i18n/locales/ru.jsonweb/src/i18n/locales/vi.jsonweb/src/i18n/locales/zh-CN.jsonweb/src/i18n/locales/zh-TW.json
feat(web): add custom-model create hint and i18n translations
PR 类型
PR 是否包含破坏性更新?
PR 描述
优化“模型下拉搜索”场景的防呆体验:当用户在下拉框中搜索不到模型时,明确提示可按回车将输入内容作为自定义模型名加入,降低误解和重复适配诉求。
Summary by CodeRabbit
Release Notes
New Features
Localization