Skip to content

fix(desktop): align reply feedback buttons and add Help menu Feedback entry - #5391

Merged
Grapedge merged 2 commits into
release/2026-11-25from
feedback-ux
Nov 25, 2026
Merged

Grapedge merged 2 commits into
release/2026-11-25from
feedback-ux

Conversation

@Grapedge

@Grapedge Grapedge commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Screenshots / Recordings

观察消息底部的四个操作按钮(复制、分叉、点赞、点踩):悬停点赞按钮时,未悬停图标色、悬停图标色、背景色、圆角及无箭头 tooltip 已与左侧复制、分叉按钮一致。

对齐后的消息流回复操作按钮与悬停 tooltip

Requirement or Bug

桌面端会话消息流中的点赞、点踩按钮在默认颜色、hover 态与 tooltip 样式上和左侧复制、分叉按钮不一致;同时,全局反馈入口此前只存在于左下角账户菜单。本次改动将消息流中的点赞、点踩按钮对齐复制、分叉按钮的样式和 tooltip,并在顶部 Help 菜单的 Documentation / 使用文档 下方新增 Feedback / 反馈 菜单项,点击效果与账户菜单中的反馈一致,且保留 menu 来源归因并在渲染端尚未完成初始化时排队等待就绪后打开。

Bug Reproduction Steps

  1. 在桌面端完成一轮回复,对比消息底部点赞、点踩按钮与左侧复制、分叉按钮的默认颜色,分别悬停查看高亮样式与 tooltip。
  2. 打开顶部 Help / 帮助 菜单,查看菜单项中是否包含反馈入口。

Root Cause

  • apps/desktop/src/renderer/components/feedback/TurnFeedbackActions.vue 给 <IconButton> 传了 size="sm" 和 tooltip-arrow,并用本地样式覆写了 color: var(--color-send-bg) 与 border-radius: var(--radius-sm),未将 hover 图标色设为 --color-accent,导致视觉与 ChatPane.vue 的 .a-cpbtn 偏离;同时已选中态在 hover 时被 IconButton.vue 的 .ui-icon-button.is-pressed:hover:not(:disabled) 覆盖为中性灰背景。
  • Electron 菜单模板 apps/desktop/src/main/shell/menu.ts 的 helpMenu 尚未包含反馈菜单项,apps/desktop/src/renderer/App.vue 的 onMenuAction 也未处理对应菜单事件,且 POST /api/v1/feedback 的全局反馈 source 枚举此前只允许 sidebar 与 command。

Code Changes

改动落在回复反馈按钮组件、Electron 菜单到渲染端的派发链路,以及 KAP 反馈接口的 source 枚举扩展三处。

1. 回复反馈按钮对齐复制、分叉按钮

 <TurnFeedbackActions>
-  <IconButton size="sm" tooltip-arrow>   /* color: --color-send-bg, radius-sm, 带箭头大号 tooltip */
+  <IconButton size="xs">                 /* 复用 IconButton xs: 20×20, radius-xs, --color-text-muted, 标准无箭头 tooltip */
+    :hover:not(:disabled)                /* color: --color-accent, background: --color-hover */
+    [aria-pressed='true']:hover          /* 保持主题色与 10% 主题色背景 */

改为 size="xs" 后,按钮直接复用 IconButton 的 20px × 20px、--radius-xs 与 --color-text-muted 默认值,本地样式只需去掉 hairline 边框并补齐 hover 与选中态 hover 规则;移除 tooltip-arrow 后,tooltip 走与 .a-cpbtn 相同的 .ui-tip-surface 标准气泡。

2. Help 菜单新增 Feedback / 反馈入口与初始化排队

 Electron Help Menu (menuTemplate -> windowsMenuTemplate 复用 help.submenu)
   help-docs (Documentation / 使用文档)
+  open-feedback (Feedback / 反馈) -> showMainWindow() + sendToRenderer(IPC.menuAction, 'open-feedback')
   help-console (Console / 控制台)

 App.vue onMenuAction('open-feedback')
+  initialized === false -> runWhenInitialized(initialized, openFromMenu) (去重并在卸载时取消)
+  initialized === true  -> if (anyOverlayOpen.value) return
+                           track('action_invoked', { action: 'open-feedback', source: 'menu' })
+                           openGlobalFeedback('menu')

windowsMenuTemplate 直接展开 help.submenu,因此只需在 helpMenu 的 help-docs 之后插入 open-feedback,macOS/Linux 原生菜单和 Windows/Linux 自定义标题栏菜单都会同步出现。渲染端复用 openGlobalFeedback('menu')(未登录时弹出登录框、已登录时打开反馈弹窗并携带当前会话);当点击发生在应用刚启动或重载、initialized.value 尚未为 true 时,通过 runWhenInitialized 延迟到初始化完成后再打开,同时对多次重复点击去重,并在组件卸载时停止监听。

3. KAP POST /api/v1/feedback 契约扩展(packages/kap-server/schema/contract.txt)

  • 在 packages/kap-server/src/protocol/rest-feedback.ts、packages/app-core/src/api/types.ts 和 apps/desktop/src/renderer/composables/useDesktopFeedback.ts 中将 kind: "global" 的 source 枚举扩展为 "sidebar" | "command" | "menu",并同步刷新 packages/kap-server/schema/openapi.json、packages/kap-server/schema/contract.txt 与 packages/kap-server/test/apiSurface.test.ts 中的 HOST_CONTRACT.digest。
  • 使用方与兼容性说明:
    • 使用方包括桌面端(apps/desktop)、Web 端(通过 @moonshot-ai/app-core 调用)以及直接调用 POST /api/v1/feedback 的外部 KAP 客户端。
    • 变更仅为枚举增项:既有客户端继续发送 "sidebar" 或 "command" 的行为保持不变,服务端存储与既有数据不受影响。
    • HOST_API_LEVEL 保持为 1:packages/app-core/src/api/hostRouting.ts 中的 route_createFeedback 将 kind: "global" 固定路由到本地内嵌 kap-server(this.local),不会把带 source: "menu" 的请求发往旧版本远程 SSH 宿主。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
回复点赞、点踩按钮默认颜色、圆角与 hover 态 默认色为 --color-send-bg、圆角 --radius-sm、hover 为 --color-text,激活态 hover 会变成 --color-selected-hover 默认色 --color-text-muted、圆角 --radius-xs、hover 为 --color-accent + --color-hover,激活态 hover 保持 --color-accent 与 10% 主题色背景 桌面端与 kimi web 共用 apps/desktop/src/renderer 的用户 无(纯样式对齐)
回复点赞、点踩按钮 tooltip 渲染带三角形箭头的 .ui-tip__bubble--arrow 气泡 渲染与复制、分叉按钮一致的无箭头 .ui-tip-surface 气泡 桌面端与 kimi web 共用 apps/desktop/src/renderer 的用户 无(纯样式对齐)
桌面端 Help 菜单项 Documentation 后紧接 Console 在 Documentation / 使用文档 下方、Console / 控制台 上方新增 Feedback / 反馈,点击打开全局反馈弹窗(未登录先弹登录框);启动或重载未初始化完成时排队并在就绪后打开 桌面端 macOS/Linux 原生菜单与 Windows/Linux 自定义标题栏菜单用户 新增入口,不改变既有菜单项
POST /api/v1/feedback 全局反馈 source 仅接受 "sidebar"、"command" 接受 "sidebar"、"command"、"menu" 桌面端、Web 端与外部 KAP 客户端 向后兼容的枚举增项,原值继续可用
  • 受影响模块:apps/desktop(主进程菜单、共享 action-id 列表、渲染端 App.vue、useDesktopFeedback.ts、useTrayAttention.ts 与 TurnFeedbackActions.vue)、packages/app-core(CreateFeedbackInput 类型)、packages/kap-server(rest-feedback.ts 与契约快照)。
  • 测试覆盖:
    • 菜单项双语文案、位置顺序(help-docs 之后、help-console 之前)、窗口唤起与 IPC 派发、不重复记主进程 menu_action、自定义标题栏 Help 菜单覆盖:apps/desktop/tests/main/shell/menu.test.ts。
    • 点赞/点踩按钮 xs 尺寸与标准无箭头 tooltip 渲染:apps/desktop/tests/renderer/turnFeedbackPopover.test.ts。
    • runWhenInitialized 立即执行、延迟触发以及取消句柄停止回调:apps/desktop/tests/renderer/useTrayAttention.test.ts。
    • POST /api/v1/feedback 接受 source: 'menu' 与契约摘要:packages/kap-server/test/feedback.e2e.test.ts、packages/kap-server/test/apiSurface.test.ts。
    • 真实 Electron 窗口端到端覆盖启动/重载加载中点击 Help > Feedback 排队与去重、未登录弹登录框、已登录提交 source: 'menu' 全局反馈,以及深浅色主题下复制/分叉/点赞/点踩的 idle 颜色、圆角、hover 颜色/背景、tooltip 样式与激活态 hover:apps/desktop/e2e/desktop-feedback.spec.ts。
    • 未验证项:Windows 平台实机菜单弹出未在本机(macOS)运行,Windows 自定义标题栏菜单模板结构由 windowsMenuTemplate 单测覆盖。
本地验证命令与结果
  • pnpm lint:通过(0 warnings, 0 errors)
  • pnpm exec tsc -p packages/kap-server/tsconfig.json --noEmit:通过
  • pnpm --filter kimi-code-app run typecheck:通过
  • pnpm exec vitest run --reporter=agent packages/kap-server/test/apiSurface.test.ts packages/kap-server/test/feedback.e2e.test.ts apps/desktop/tests/main/shell/menu.test.ts apps/desktop/tests/renderer/turnFeedbackPopover.test.ts apps/desktop/tests/renderer/useDesktopFeedback.test.ts apps/desktop/tests/renderer/useTrayAttention.test.ts:6 files / 100 tests 通过
  • pnpm exec vitest run --reporter=agent packages/app-core/test/daemon-client.test.ts:1 file / 96 tests 通过
  • pnpm exec vitest run --reporter=agent packages/app-core/test/hostRouting.test.ts packages/kap-server/test/feedbackSessionArchive.test.ts:2 files / 38 tests 通过
  • pnpm --filter kimi-code-app run e2e:headless desktop-feedback.spec.ts --retries=0 --grep "opens feedback from the Help menu":完整构建后 2 tests(含 smoke)通过
  • pnpm run check:duplication $(git merge-base origin/release/2026-11-25 HEAD):通过(0 新增重复)

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5d8c49c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
kimi-code-app Patch
@moonshot-ai/kap-server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T07:03:21.862655Z 5d8c49c New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Grapedge added a commit that referenced this pull request Nov 25, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd53db0830

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/renderer/App.vue Resolved
Comment thread apps/desktop/src/renderer/App.vue Resolved
@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@5d8c49c
npx https://pkg.pr.new/@moonshot-ai/kimi-code@5d8c49c

commit: 5d8c49c

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a7ff3f0e1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/desktop/src/main/shell/menu.ts Resolved
@Grapedge
Grapedge merged commit 5bd5009 into release/2026-11-25 Nov 25, 2026
32 of 36 checks passed
@Grapedge
Grapedge deleted the feedback-ux branch November 25, 2026 08:18
kimi-agent-bot pushed a commit that referenced this pull request Nov 25, 2026
… entry (#5391)

* fix(desktop): align reply feedback buttons and add Help menu Feedback entry

* fix(desktop): add menu feedback source and queue Help menu feedback until initialized
kimi-agent-bot pushed a commit that referenced this pull request Nov 25, 2026
… entry (#5391)

* fix(desktop): align reply feedback buttons and add Help menu Feedback entry

* fix(desktop): add menu feedback source and queue Help menu feedback until initialized
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.

3 participants