Skip to content

feat: 通知音效系统 — 生成完成 + 等待操作提示音#4176

Merged
SivanCola merged 2 commits into
esengine:main-v2from
ttmouse:pr/notification-sounds
Jun 12, 2026
Merged

feat: 通知音效系统 — 生成完成 + 等待操作提示音#4176
SivanCola merged 2 commits into
esengine:main-v2from
ttmouse:pr/notification-sounds

Conversation

@ttmouse

@ttmouse ttmouse commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

概述

新增通知音效系统,两个场景各有独立的音效选择(默认关闭):

  • 生成完成:AI 回答完成时播放成功音效
  • 等待操作:AskCard/ApprovalModal 弹出时播放注意音效

改动清单

分类 文件 说明
🆕 新增 src/lib/sound.ts 音效核心模块:合成音 + WAV + localStorage 偏好
🆕 新增 src/components/SoundSelect.tsx 自定义下拉组件(AnchoredPopover)
🆕 新增 4 × public/sounds/*.wav Mixkit 免费音效
🔧 修改 desktop/tabs.go TurnDone 时发射 agent:turn-done 事件
🔧 修改 src/lib/bridge.ts 新增 onTurnDone() 函数
🔧 修改 src/App.tsx 通过 onTurnDone 播放成功音效
🔧 修改 src/components/AskCard.tsx 挂载时播放注意音效
🔧 修改 src/components/ApprovalModal.tsx 挂载时播放注意音效
🔧 修改 src/components/SettingsPanel.tsx General 页两个音效选择器
🔧 修改 src/locales/en.ts / zh.ts 各 11 条 i18n 词条
🔧 修改 src/styles.css 自定义下拉组件样式

验证方式

  1. 打开 App → 设置 → General → 可见两行音效选择器
  2. 选择音效 → 点 ▶ 预览试听
  3. 发送消息等待生成完成 → 听到成功音效
  4. AI 提问或工具审批弹出 → 听到注意音效

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jun 12, 2026
@ttmouse

ttmouse commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author
image

@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: 7d3d442a49

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/tabs.go Outdated
ttmouse added a commit to ttmouse/DeepSeek-Reasonix that referenced this pull request Jun 12, 2026
参考 notification-sound PR (esengine#4176) 的 SoundSelect 样式,
将原生 <select> 替换为 AnchoredPopover + trigger 按钮 +
勾选图标的自定义下拉组件。
- Add sound.ts: notification sound core module (synth + WAV playback)
- Add 4 Mixkit WAV sound effects
- bridge.ts: add onTurnDone() for agent:turn-done event
- tabs.go: emit agent:turn-done event on TurnDone
- App.tsx: playSuccessChime on generation complete
- AskCard/ApprovalModal: playAttentionChime on user confirmation
- SettingsPanel: two sound selectors (success + attention) in General section
- SoundSelect: custom dropdown component with AnchoredPopover
- i18n: EN/ZH notification sound labels
- Default: off, can be toggled to synth or WAV sounds
@ttmouse ttmouse force-pushed the pr/notification-sounds branch from 7d3d442 to e9bd6f5 Compare June 12, 2026 10:28

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding this. I found two issues that should be fixed before merge:

  1. The frontend build currently fails in SoundSelect.tsx. labelKey is typed as plain string, but useT() only accepts the DictKey union, so both t(selected.labelKey) and t(opt.labelKey) produce TS2345. Please type labelKey as DictKey or use an as const satisfies ... shape for the options.

  2. The success chime currently plays for failed turns too. TurnDone already carries Err through the existing turn_done wire event, but the new agent:turn-done event drops that payload and App.tsx calls playSuccessChime() unconditionally. Please reuse onEvent and gate on e.kind === "turn_done" && !e.err, or include the outcome in the new event so model errors/panics/rate limits do not play a success sound.

Validation I ran:

  • cd desktop && go test ./... passed
  • cd desktop/frontend && pnpm build failed on the SoundSelect.tsx typing issue above

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the update. The SoundSelect.tsx typing issue is fixed now: labelKey is typed as DictKey, and the previous TS2345 errors are gone.

One requested change is still outstanding: the success chime still plays for failed turns. The PR still emits a separate payload-less agent:turn-done event from tabs.go, and App.tsx still calls playSuccessChime() unconditionally from that event. Since the existing turn_done wire event already carries err, please gate the sound on the existing event, e.g. only play when e.kind === "turn_done" && !e.err, or include the outcome/error in the new event before deciding which sound to play.

Validation I ran on the updated head:

  • cd desktop && go test ./... passed
  • cd desktop/frontend && pnpm build no longer reports the SoundSelect.tsx errors; it still stops on missing local Wails generated modules in this checkout (../../wailsjs/...), which appears unrelated to this PR update.

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Pushed a small follow-up fix to this PR.

What changed:

  • Reused the existing turn_done wire event instead of adding a separate payload-less agent:turn-done channel.
  • Play the success chime only when turn_done has no err, so failed turns no longer sound like successful completions.
  • Removed the extra bridge helper and Go event emit.

Validation:

  • cd desktop && go test ./... passed
  • cd desktop && wails generate module
  • cd desktop/frontend && pnpm build passed

@SivanCola

Copy link
Copy Markdown
Collaborator

approve

@SivanCola SivanCola enabled auto-merge June 12, 2026 11:10
@SivanCola SivanCola merged commit 780302d into esengine:main-v2 Jun 12, 2026
13 checks passed
ashishexee added a commit to ashishexee/DeepSeek-Reasonix that referenced this pull request Jun 13, 2026
…nces counter

Fixes esengine#4176

When a plan is approved, the controller emits a plan-seed todo_write event
(frontend shows the list) but did not initialize the agent's todoState.
The agent's todoState is only set when the model calls todo_write itself,
which it may skip since the plan-seed already displays the list.

When the model then calls complete_step, advanceCanonicalTodo checks
len(todoState) == 0 and returns early — no synthetic todo_write event is
emitted, so the frontend counter stays at 0/x.

Fix: after seedPlanTodos emits the plan-seed events, also call the new
Agent.SeedTodoState() to initialize the agent's canonical todo list from
the parsed plan. SeedTodoState is a no-op when the agent already has a
todoState (e.g. the model already called todo_write), avoiding overwrites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants