feat(keys): surface chat export and CC Switch as dedicated buttons - #5396
feat(keys): surface chat export and CC Switch as dedicated buttons#5396gaoren002 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (2)
WalkthroughThis PR updates chat export actions in the classic token table and the default key row actions. It replaces split/submenu-based controls with dropdown-driven export choices and adds matching English and Chinese locale entries. ChangesChat Export UI Refactor
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
web/default/src/features/keys/components/data-table-row-actions.tsx (2)
207-213:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winReplace nested ternary icon rendering with explicit branching.
The icon render uses a multi-level ternary, which is prohibited for
web/default/**/*.{ts,tsx}.As per coding guidelines: “Prohibit nested ternary expressions with 2 or more levels; use `if-else`, early returns, or extract functions instead.”Suggested fix
+ let statusIcon = <Power className='size-4' /> + if (isTogglingStatus) { + statusIcon = <Loader2 className='size-4 animate-spin' /> + } else if (isEnabled) { + statusIcon = <PowerOff className='size-4' /> + } ... - {isTogglingStatus ? ( - <Loader2 className='size-4 animate-spin' /> - ) : isEnabled ? ( - <PowerOff className='size-4' /> - ) : ( - <Power className='size-4' /> - )} + {statusIcon}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/default/src/features/keys/components/data-table-row-actions.tsx` around lines 207 - 213, The nested ternary used to choose the icon in the DataTableRowActions JSX should be replaced with explicit branching: create a small helper function (e.g., getStatusIcon or inline if/else block in the render) that checks isTogglingStatus first, then isEnabled, and returns Loader2, PowerOff, or Power accordingly; replace the existing ternary expression referencing isTogglingStatus/isEnabled with a call to that helper or with an if-else that returns the appropriate JSX element to satisfy the no-nested-ternary rule.Source: Coding guidelines
82-84:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAvoid destructuring component props in this TSX component.
The component signature destructures
row, which violates the repo’s TSX prop-style rule forweb/default.As per coding guidelines: “Do not destructure component props; use `props.xxx` directly instead for clarity.”Suggested fix
-export function DataTableRowActions<TData>({ - row, -}: DataTableRowActionsProps<TData>) { +export function DataTableRowActions<TData>( + props: DataTableRowActionsProps<TData> +) { const { t } = useTranslation() - const apiKey = apiKeySchema.parse(row.original) + const apiKey = apiKeySchema.parse(props.row.original)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/default/src/features/keys/components/data-table-row-actions.tsx` around lines 82 - 84, The component DataTableRowActions currently destructures props in its signature (row) which violates the TSX prop-style rule; change the function to accept a single props parameter (e.g., props: DataTableRowActionsProps<TData>) and update all internal references from `row` to `props.row` so the component uses props.xxx access rather than destructuring in the function signature.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@web/default/src/features/keys/components/data-table-row-actions.tsx`:
- Around line 207-213: The nested ternary used to choose the icon in the
DataTableRowActions JSX should be replaced with explicit branching: create a
small helper function (e.g., getStatusIcon or inline if/else block in the
render) that checks isTogglingStatus first, then isEnabled, and returns Loader2,
PowerOff, or Power accordingly; replace the existing ternary expression
referencing isTogglingStatus/isEnabled with a call to that helper or with an
if-else that returns the appropriate JSX element to satisfy the
no-nested-ternary rule.
- Around line 82-84: The component DataTableRowActions currently destructures
props in its signature (row) which violates the TSX prop-style rule; change the
function to accept a single props parameter (e.g., props:
DataTableRowActionsProps<TData>) and update all internal references from `row`
to `props.row` so the component uses props.xxx access rather than destructuring
in the function signature.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6bbe39e2-1cc1-4c25-b287-3725071e3af7
📒 Files selected for processing (4)
web/classic/src/components/table/tokens/TokensColumnDefs.jsxweb/classic/src/i18n/locales/en.jsonweb/default/src/features/keys/components/data-table-row-actions.tsxweb/default/src/i18n/locales/zh.json
239fb58 to
9343c11
Compare
- Move the per-key chat presets out of the row overflow ("...") menu into a
dedicated "Chat (Export to)" dropdown so the export action is discoverable.
- Move the CC Switch action out of the overflow menu into a dedicated
"Export to CCS" button next to it.
- Classic theme: collapse the split button (whose primary action defaulted to
the first preset, usually Cherry Studio) into a single "Chat (Export to)"
dropdown with no implicit default target.
- Stop translating the "CC Switch" product name in zh-CN (was "CC 切换").
9343c11 to
897b331
Compare
51fdfc5 to
2b6f1df
Compare
📝 变更描述 / Description
缘由:经常有用户询问怎么导出CCS,实际上newapi具备此功能,但实在太不直观,需要优化增强。
做法:把新UI的令牌行里两个常用的"导出/对接客户端"动作从行尾"…"溢出菜单里拿出来,把旧UI的聊天按钮和旁边的下拉框统一,做成更直观的独立按钮,并统一文案:
新旧UI都有的修改:1. "CC Switch" 是客户端产品名, 之前被译成"CC 切换";改为不翻译,保留原名。
2.“聊天”按钮不够准确,改为“聊天(导出到)”。
针对于新UI:
3. 聊天预设:从溢出菜单的子菜单挪出,改为独立的「聊天(导出到)」下拉(default 主题)。
4. CC Switch:从溢出菜单挪出,改为独立的「导出到CCS」按钮(点开同一个 CC Switch 配置弹窗)。
针对于旧UI:
5. classic 主题:原本是 SplitButton——主按钮默认直接触发第一个预设(通常是 Cherry Studio),这种行为不够可控。现合并为单个「聊天(导出到)」下拉,去掉"默认直接打开某客户端"的隐式行为,统一从下拉里选目标。
补齐对应 i18n(default
Chat (Export to)、Export to CCS;classic 英文映射),并清理因移除菜单项而失用的图标 import。🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
📸 运行证明 / Proof of Work
[聊天(导出到)▾] [导出到CCS] [⋯];"…"菜单中不再有 Chat 子项与 CC Switch;CC Switch 显示为原名。Summary by CodeRabbit
New Features
UI/UX Changes
Localization