fix(core): always trigger done_emoji when agent finishes

Previously done_emoji only fired when stream preview had been updated
in-place at least once, which meant quick responses never triggered
the reaction. Remove the needsDoneReaction() gate so the platform's
AddDoneReaction is always called on EventResult.

Made-with: Cursor
This commit is contained in:
Claude committed 2026-04-17 10:12:48 +08:00
1 parent 00e6f7600e
commit c660aff4e8
3 files changed
+9 -13

No files matched your search

+2 -2
View File
@@ -746,8 +746,8 @@ app_secret = "your-feishu-app-secret"
# # 允许的用户 open_id,逗号分隔;"*" 表示所有(默认)。发送 /whoami 获取你的 open_id。
# reaction_emoji = "OnIt" # Emoji reaction on incoming messages (default: "OnIt"); set to "none" to disable
# # 收到消息时添加的表情回复(默认 "OnIt");设为 "none" 可禁用
# done_emoji = "none" # Emoji reaction after agent finishes streaming work in quiet mode (e.g. "Done"); set to "none" to disable
# # Agent 在 quiet 模式下完成流式工作后的表情回复(如 "Done");设为 "none" 可禁用
# done_emoji = "none" # Emoji reaction when agent finishes a reply (e.g. "Done"); set to "none" to disable
# # Agent 完成回复后添加的表情回复(如 "Done");设为 "none" 可禁用
# group_reply_all = false # If true, respond to ALL group messages without requiring @mention
# # 设为 true 时,群聊中无需 @机器人 也会响应所有消息(默认 false)
# share_session_in_channel = false # If true, all users in a group share one agent session
+5 -9
View File
@@ -3080,15 +3080,11 @@ func (e *Engine) processInteractiveEvents(state *interactiveState, session *Sess
}
}
// When the preview was updated in-place at least once (e.g. Feishu card
// streaming), the user only saw a push for the initial send and subsequent
// updates were silent. Add a "done" reaction so they know the agent finished.
// The reaction is added after stopTyping (deferred) so the doing emoji
// is removed first.
if sp.needsDoneReaction() {
if doneTI, ok := p.(TypingIndicatorDone); ok {
doneReaction = func() { doneTI.AddDoneReaction(replyCtx) }
}
// Add a "done" reaction so the user knows the agent finished.
// The reaction is added after stopTyping (deferred) so the
// "doing" emoji is removed first.
if doneTI, ok := p.(TypingIndicatorDone); ok {
doneReaction = func() { doneTI.AddDoneReaction(replyCtx) }
}
return
+2 -2
View File
@@ -111,14 +111,14 @@ app_secret = "QhkMpxxxxxxxxxxxxxxxxxxxx"
# enable_feishu_card = true # 可选:关闭后统一回退纯文本回复
# thread_isolation = true # 可选:按飞书 thread/root 隔离群聊会话
# progress_style = "legacy" # 可选:legacy | compact | card
# done_emoji = "none" # 可选:quiet 模式下 agent 流式工作完成后添加的表情回复(如 "Done");设为 "none" 可禁用
# done_emoji = "none" # 可选:agent 完成回复后添加的表情回复(如 "Done");设为 "none" 可禁用
```
> 如果应用没有交互卡片权限,或后台未配置卡片回调,可将 `enable_feishu_card = false`,让所有命令统一走纯文本回复,避免卡片发送失败后用户看不到内容。
> 如果开启 `thread_isolation = true`,群聊里每个根消息 / reply thread 会对应一个独立 agent session;私聊行为保持原样。
> `progress_style = "compact"` 会把思考/工具进度合并到一条可更新消息里,减少刷屏;`legacy` 保持原有逐条发送;`card` 会使用结构化卡片(标题 + 进度块)持续更新同一条消息,观感比纯文本更清晰。
> `domain` 只影响运行时 API / WebSocket 请求地址;CLI `setup/new/bind` 的引导域名仍然使用内置默认值。
> `done_emoji` 仅在 quiet 模式下、飞书卡片被流式更新过(通过 UpdateMessage 原地编辑)时生效:先移除 "OnIt" 表情,再添加你指定的 done 表情,这样用户能收到飞书推送通知。飞书卡片原地更新本身不会触发推送,所以 quiet 模式下用户可能不知道 agent 已完成。单轮纯文本回复(只通过 SendPreviewStart 发送)不会触发此行为。设为 `"none"` 或不配置则禁用。
> `done_emoji` 设置后,agent 每次完成回复时会在用户消息上添加指定表情(如 `"Done"` → ✅)。先移除 "OnIt" 表情(如果有),再添加 done 表情。在 quiet 模式下特别有用,因为飞书卡片原地更新不触发推送,done 表情可以通知用户 agent 已完成。设为 `"none"` 或不配置则禁用。
---