Skip to content

tts: strip emoji, diagrams, code, tables from TTS preprocessing - #25956

Closed
nnnet wants to merge 0 commit into
NousResearch:mainfrom
nnnet:main
Closed

nnnet wants to merge 0 commit into
NousResearch:mainfrom
nnnet:main

Conversation

@nnnet

@nnnet nnnet commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

_strip_markdown_for_tts only handled basic markdown (bold/italic/headers/lists/code-fences/links) but left through everything that TTS engines (edge, kokoro, piper, xtts) read as garbage: emoji, dingbats, box-drawing diagrams, geometric shapes, arrows, math operators, and ASCII divider lines.

Symptoms reported in production:

  • "✅ Готово" read as "галочка большая Готово"
  • "⚙️ mcp_filesystem_edit_file" read as "медный значок"
  • Diagram ┌─┐ │ box │ └─┘ → long awkward pauses with "box" mangled
  • Inline code → identifiers pronounced character-by-character

This patch extends the function to also drop:

  • inline backtick code (entire snippet, not just backticks)
  • markdown tables (entire rows — TTS can't read columnar layout)
  • blockquote prefix >
  • Unicode pictographs / dingbats / box-drawing / geometric shapes / arrows / math symbols / variation selectors / ZWJ joiners
  • pure-divider lines (────── or ============)

The original chat output is untouched — the function runs only on the copy passed to the TTS engine. Telegram/Discord/terminal messages remain visually formatted; only the spoken reply gets clean prose.

Test plan

  • Manual tests with Cyrillic + ASCII text containing emoji, headers, lists, code-blocks, tables, diagrams — all stripped correctly
  • Run upstream test suite (if any covers _strip_markdown_for_tts)
  • Real-world test with edge-tts engine — confirm no regressions on normal text

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/tts Text-to-speech and transcription comp/tools Tool registry, model_tools, toolsets duplicate This issue or pull request already exists labels May 14, 2026
@alt-glitch

Copy link
Copy Markdown
Contributor

Duplicate of #8205 which is the most comprehensive TTS preprocessing PR (strips markdown, localizes 28 emojis across 13 languages). Also overlaps with #13311 and #18598. Additionally, this PR contains 8 unrelated file changes (.env.example, sync.yml, auxiliary_client.py, codex.py, gateway/run.py, config.py, dashboard dist, run_agent.py) beyond the TTS scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have tool/tts Text-to-speech and transcription type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants