Conversation
f91c10a to
0e4f75a
Compare
492ef8c to
774a574
Compare
5139e1d to
4d6fad3
Compare
a504be9 to
d9d9cfb
Compare
4f4541e to
14ff52b
Compare
a842a2c to
9aa8bd4
Compare
a279e45 to
537eff0
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for covering the direct tool call path. Current main already has the Telegram-only Opus routing from ed9087fce (tools/tts_tool.py:2202, :2421-2430), while text_to_speech_tool still sends raw Markdown after its truncation logic (tools/tts_tool.py:2177-2194); the proposed normalization addresses that remaining path.
Problems
skip_markdown_stripis a new user-facingtts.providers.<name>setting, but the command-provider optional-key table omits it (website/docs/user-guide/features/tts.md:309-317). Users need its default and SSML/raw-markup purpose documented.
Suggested changes
- Add
skip_markdown_stripto the command-provider documentation, stating that it defaults tofalseand preserves raw text for providers that require markup.
Automated hermes-sweeper review.
| # the Auto-TTS path in gateway/platforms/base.py) already strip markdown; | ||
| # this brings the agent-callable tool path in line with them. | ||
| # Command-providers can opt out via tts.providers.<name>.skip_markdown_strip | ||
| # for SSML-aware CLIs that want raw markup passed through. |
There was a problem hiding this comment.
skip_markdown_strip is a public command-provider config option, but the documented optional-key table at website/docs/user-guide/features/tts.md:309-317 does not list it. Please document its default and SSML/raw-markup use case.
|
Review feedback addressed in
|
|
Rebased onto current main. Upstream has since restructured the TTS path — text normalization ( |
The agent-callable text_to_speech_tool() did not strip markdown before
provider dispatch. Result: Edge TTS (and other providers) verbalized raw
markdown artifacts like *bold* ("asterisk asterisk Bold asterisk asterisk"),
Two other TTS call sites already strip markdown:
- gateway/run.py:_send_voice_reply via _strip_markdown_for_tts()
- gateway/platforms/base.py Auto-TTS via re.sub regex
This brings the third call site (the model-callable tool) in line with
them. Strip happens after empty-check and before max_len truncation, so
the per-provider character budget applies to spoken length, not raw
markdown length.
Command-providers can opt out via tts.providers.<name>.skip_markdown_strip
for SSML-aware CLIs that need raw markup passed through.
Tests: tests/tools/test_tts_markdown_strip.py — 7 cases covering bold,
headers, inline code, list markers, truncation interaction, and the
skip-opt-out flag for command providers.
What does this PR do?
Fixes two TTS delivery issues:
OGG/Opus conversion was applied to all platforms — only Telegram requires Opus for voice bubbles. Other platforms (Discord, Nextcloud Talk, etc.) work better with the original MP3/WAV. The fix adds a
want_opusflag derived from the platform.Markdown artifacts in MEDIA paths — some models (e.g., Mistral) wrap MEDIA tags in bold/italic markdown (
**MEDIA:/tmp/file.mp3**). The fix strips*and_from media path extraction.Related Issue
No existing issue.
Type of Change
Changes Made
tools/tts_tool.py: Addwant_opusflag gated onplatform == "telegram", applied at all three OGG conversion decision pointsgateway/platforms/base.py: Add*_to lstrip/rstrip inextract_mediapath parsingtests/gateway/test_send_image_file.py: 4 tests for markdown artifact stripping (bold, italic, underscore, mixed)How to Test
**MEDIA:/tmp/test.mp3**— path should extract cleanlypytest tests/gateway/test_send_image_file.py -v— all tests passChecklist
pytest tests/ -qpasses