TTS 语音被重复发送:将 tts 纳入消息媒体去重链路
问题/场景:Telegram/Discord 收到重复语音。前置条件:开启 tts 工具并经 reply dispatcher 发送媒体。实施步骤:把 tts 纳入 CORE_MESSAGING_TOOLS → 在 collectMessagingMediaUrlsFromToolResult 识别 `MEDIA:` 与 details.audioPath → 交由 filterMessagingToolMediaDuplicates 去重 → 渠道侧保留兜底 per-delivery 去重。关键配置:toolName=tts 的媒体 URL 收集。验证:同一次回复仅收到 1 条语音。风险:错误去重可能吞掉不同音频,需验证唯一键策略。来源:Issue #21205。
GITHUBDiscovered 2026-02-20Author tbbmz1907
Prerequisites
- Telegram or Discord channel is enabled and voice output uses the `tts` tool.
- You can patch tool result handling and messaging dedup logic in gateway code.
Steps
- Reproduce duplicate voice notes by requesting one TTS response in Telegram/Discord.
- Add `tts` to messaging-tool dedup eligibility so sent media can enter dedup tracking.
- Extend media URL extraction to parse `MEDIA:/path` and `details.audioPath` fields from tool results.
- Keep channel-level per-delivery dedup as fallback and run end-to-end send tests.
Commands
npm run buildopenclaw gateway restartopenclaw gateway statusVerify
For one TTS request, exactly one voice note is delivered and no duplicate media URL appears in delivery batch.
Caveats
- Do not set mediaList to empty as workaround on newer versions; it may drop all TTS audio.
- When two different clips share same file path semantics, path-only dedup may cause false positives(需验证).
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗