Commit f8e9f97
fix(voice): 修复带工具调用的语音轮「有声无字」 (#1646)
* fix(voice): 修复带工具调用的语音轮「有声无字」
部分语音 provider(lanlan.app Gemini 代理)只发 response.audio_transcript.delta、
不发 response.audio_transcript.done,输出转录全靠 _print_input_transcript=True 的
streaming 分支实时送出。但工具调用(如 recall_memory)那一轮的 response.done 会把
_print_input_transcript 置 False,紧随其后的真回复转录便走 buffer 分支累积进
_output_transcript_buffer,无 transcript.done 来 flush,最终在 response.done 被直接
清空 → 前端有声无字。
在 response.done 清空 buffer 前补一次 flush:仅当本轮真出过声(audio_delta_count>0)
且 buffer 仍有残留时补发。streaming 分支每次都会清空 buffer,正常轮此处为 no-op,
不会重复发送。flush 在 on_response_done(turn_end) 之前触发,时序正确。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore(voice): 兜底 flush 输出转录时加一条 debug 日志
「有声无字」是反复出现的问题,留一条 debug 日志方便下次诊断时区分是
response.done 兜底生效、还是 streaming / transcript.done 路径生效。
采纳 CodeRabbit 评审建议。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Hongzhi Wen <cartabio.coder1@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent baa6088 commit f8e9f97
1 file changed
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2639 | 2639 | | |
2640 | 2640 | | |
2641 | 2641 | | |
| 2642 | + | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
| 2652 | + | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
| 2659 | + | |
| 2660 | + | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
2642 | 2669 | | |
2643 | 2670 | | |
2644 | 2671 | | |
| |||
0 commit comments