Repository navigation
feat(providers): add a copy button to the API key input - #9232
Merged
Merged
Conversation
Reading an API key back meant toggling visibility and selecting the text by hand. Add a copy action to the label row that copies the whole key in one click and reports the outcome as a toast. - Copy the trimmed value, matching what the form saves, so pasted keys with stray whitespace do not carry it into the clipboard - Hide the button while the field is empty or disabled, and render it before labelAside so the trailing link does not shift when the button appears - Add apiKeyInput.copied / copyFailed to en, ja, tr, zh and zh-TW - Cover copy, trimming, empty/whitespace, disabled and failure paths in ApiKeySection.test.tsx
minimote
force-pushed
the
feat/api-key-copy-button
branch
from
November 16, 2026 00:16
1e7bdca to
e70a286
Compare
funkpopo
previously approved these changes
Nov 20, 2026
funkpopo
left a comment
Collaborator
There was a problem hiding this comment.
改动很克制清晰,解决了查看/复制已有 API Key 路径繁琐的实际痛点:
- 复制
trim()后的值与表单保存口径一致,空值、纯空白及禁用状态下隐藏按钮,排在labelAside前不会导致获取链接跳位。 - 复用现有
copyText(兼容 Linux WebView / macOS & Windows 原生剪贴板回退)与toast,8 种语言 locale 文案齐全,新增 6 条单测覆盖所有分支。 - 与最新
main(bd3d38801)无冲突,全项 CI 绿灯。
LGTM,可以直接合并。
allenxu09
previously approved these changes
Nov 20, 2026
allenxu09
left a comment
Collaborator
There was a problem hiding this comment.
LGTM
已核查本次修改(10/10 文件,对应 commit e94b8f96):
ApiKeyInput.tsx仅在非禁用且value.trim()非空时显示复制按钮,复制 trim 后的值并与labelAside并排展示,复用现有跨平台copyText与toast反馈成功/失败。- 8 种语言 locale 文件已同步补齐
apiKeyInput.copied/apiKeyInput.copyFailed,ApiKeySection.test.tsx新增 6 条测试覆盖正常复制、trim、空值、纯空白、禁用与复制失败场景,合并无冲突且 Frontend CI 全绿。
Owner
|
已合并,感谢您的贡献! 这个按钮虽小,但细节考虑得很周到:复制前先 trim,掩码状态下复制出来的也是真实 Key,空值和禁用时自动隐藏;又是在共用的 另外说明一下:main 最近把 以后如果发现什么小问题,也欢迎继续提 PR。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本人说明
用户有时需要复制之前填过的 API Key 到其他地方用,但目前的操作路径非常复杂,需要先点击密钥右侧的眼睛按钮显示密钥,然后再选中密钥,然后再复制,所以我在 API Key 标题行右侧加了一个复制按钮,可以一键复制 API Key。
概述
为 API Key 增加了一个复制按钮:一键复制完整 Key,并通过 toast 反馈结果。
labelAside之前apiKeyInput.copied/copyFailed文案截图
检查清单
pnpm typecheck通过 TypeScript 类型检查pnpm format:check通过代码格式检查cargo clippy未修改 Rust 代码