feat: C2C 正在输入(InputNotify)心跳续发(每 5s),避免气泡中途消失#171
Merged
sliverp merged 2 commits intotencent-connect:feature/1.6.2from Mar 17, 2026
Merged
feat: C2C 正在输入(InputNotify)心跳续发(每 5s),避免气泡中途消失#171sliverp merged 2 commits intotencent-connect:feature/1.6.2from
sliverp merged 2 commits intotencent-connect:feature/1.6.2from
Conversation
4f2deac to
10a0732
Compare
a433677 to
52ab44c
Compare
- 收到 C2C 消息后,启动 setInterval 每 5 秒重发一次 sendC2CInputNotify - 在 deliver 回调触发时(即实际回复前)立即清除 interval - 不影响群聊场景,仅对 event.type === 'c2c' 生效 ## 用户体验改善 QQ 客户端在以下情况会重置正在输入气泡: 1. 用户打开聊天界面 2. 系统切换前后台 原版只发送一次 InputNotify(inputSeconds=60),在上述情况下气泡会立即消失, 用户看不到 AI 正在处理的反馈,体验等同于无提示等待。 通过每 5 秒续发,气泡最多消失 5 秒便会重新出现, 对于处理耗时较长的消息(调用工具、生成语音等),用户始终能感知 AI 正在工作。 ## 技术细节 - 使用 setInterval 异步续发,不阻塞主处理流程 - 续发失败时静默忽略(非关键路径) - 每次处理完成后通过 clearInterval 立即停止,不产生多余 API 调用
52ab44c to
e598936
Compare
Collaborator
|
关于提升用户体验,非常有必要的改动,将在测试后合入。 |
Collaborator
Collaborator
|
测试发现,正在输入后不会消失,一直保持正在输入状态 |
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.

🎯 解决的问题
当 AI 处理耗时较长时(如调用工具、生成语音等),QQ 客户端的正在输入气泡会中途消失——哪怕 AI 还在处理中,用户毫无感知,只能茫然等待。
触发气泡消失的场景:
原版仅在收到消息时调用一次
sendC2CInputNotify(inputSeconds=60),以上任何一种情况都会导致气泡提前消失。✅ 解决方案
1. 心跳续发(5s 间隔)
收到 C2C 消息后,启动
setInterval每 5 秒重发一次sendC2CInputNotify。气泡最多消失 5 秒便会重新出现,对于处理耗时 10s~120s 的消息,用户始终能看到正在输入提示。2. 延迟停止心跳(多段回复优化)
原版在
deliver回调触发时立即clearInterval。但 AI 可能分多次deliver(block)发消息,每次 deliver 之间若不续发,气泡依然会消失。改为:在实际发送第一条消息前才停止 interval,确保多段回复之间也持续显示正在输入。
🌟 用户体验改善
🔧 技术细节
event.type === 'c2c'(私聊)生效,群聊行为不变