Skip to content

feat(keys): surface chat export and CC Switch as dedicated buttons - #5396

Open
gaoren002 wants to merge 1 commit into
QuantumNous:mainfrom
gaoren002:feat/chat-export-to-label
Open

feat(keys): surface chat export and CC Switch as dedicated buttons#5396
gaoren002 wants to merge 1 commit into
QuantumNous:mainfrom
gaoren002:feat/chat-export-to-label

Conversation

@gaoren002

@gaoren002 gaoren002 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

📝 变更描述 / 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

  • ⚡ 性能优化 / 重构 (Refactor)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认:描述为人工整理撰写。
  • 非重复提交:已搜索现有 Issues / PRs。
  • 变更理解:已理解改动原理与影响。
  • 范围聚焦:仅涉及令牌行操作 UI 与对应文案,无无关改动。
  • 本地验证:已随同一份代码整体 Docker 构建(前端 Rsbuild 通过)并在自有环境运行验证。
  • 安全合规:无敏感凭据,符合规范。

📸 运行证明 / Proof of Work

  • default:令牌行为 [聊天(导出到)▾] [导出到CCS] [⋯];"…"菜单中不再有 Chat 子项与 CC Switch;CC Switch 显示为原名。
  • classic:聊天按钮合并为单个「聊天(导出到)」下拉,点击不再默认打开 Cherry Studio。
image image

Summary by CodeRabbit

  • New Features

    • Added a “Chat (Export to)” dropdown for choosing a chat destination during export.
    • Added an “Export to CCS” action to export keys to CCS.
  • UI/UX Changes

    • Updated chat-related row actions from a split-button layout to a single dropdown-based control.
    • Chat export now requires explicit destination selection (no longer auto-opens the first chat).
  • Localization

    • Added/updated English and Chinese strings for the new chat/export controls.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e0df94ac-63f3-4ee6-92ef-72546a14af36

📥 Commits

Reviewing files that changed from the base of the PR and between 239fb58 and 9343c11.

📒 Files selected for processing (2)
  • web/classic/src/components/table/tokens/TokensColumnDefs.jsx
  • web/classic/src/i18n/locales/en.json
💤 Files with no reviewable changes (2)
  • web/classic/src/i18n/locales/en.json
  • web/classic/src/components/table/tokens/TokensColumnDefs.jsx

Walkthrough

This 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.

Changes

Chat Export UI Refactor

Layer / File(s) Summary
Keys row actions chat and CCS export UI
web/default/src/features/keys/components/data-table-row-actions.tsx, web/default/src/i18n/locales/zh.json
Removes submenu-based chat UI and related icon imports, adds a "Chat (Export to)" dropdown for presets, adds an "Export to CCS" button that resolves and stores the key before opening cc-switch, and updates the trailing menu actions and Chinese locale strings.
Classic tokens chat export dropdown
web/classic/src/components/table/tokens/TokensColumnDefs.jsx, web/classic/src/i18n/locales/en.json
Replaces SplitButtonGroup with a single dropdown button labeled "聊天(导出到)", keeps only the empty-chat validation on click, and adds the English translation for the new label.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • QuantumNous/new-api#5515: Both changes touch the cc-switch flow and related CC Switch text, linking the same export-to-CCS interaction.

Poem

🐰 I hopped through menus, swift and bright,
Export choices now click just right.
Chat and CCS in tidy rows,
With locale words that match the flows.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 UI change: moving chat export and CC Switch into dedicated buttons.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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.

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 win

Replace nested ternary icon rendering with explicit branching.

The icon render uses a multi-level ternary, which is prohibited for web/default/**/*.{ts,tsx}.

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}
As per coding guidelines: “Prohibit nested ternary expressions with 2 or more levels; use `if-else`, early returns, or extract functions instead.”
🤖 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 win

Avoid destructuring component props in this TSX component.

The component signature destructures row, which violates the repo’s TSX prop-style rule for web/default.

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)
As per coding guidelines: “Do not destructure component props; use `props.xxx` directly instead for clarity.”
🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between d2576dd and 239fb58.

📒 Files selected for processing (4)
  • web/classic/src/components/table/tokens/TokensColumnDefs.jsx
  • web/classic/src/i18n/locales/en.json
  • web/default/src/features/keys/components/data-table-row-actions.tsx
  • web/default/src/i18n/locales/zh.json

@gaoren002
gaoren002 force-pushed the feat/chat-export-to-label branch from 239fb58 to 9343c11 Compare July 7, 2026 07:13
- 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 切换").
@gaoren002
gaoren002 force-pushed the feat/chat-export-to-label branch from 9343c11 to 897b331 Compare July 31, 2026 14:25
@Calcium-Ion
Calcium-Ion force-pushed the main branch 2 times, most recently from 51fdfc5 to 2b6f1df Compare August 30, 2026 15: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.

1 participant