Read Aloud Plugin
The Read Aloud plugin adds a "read aloud" action to each assistant message. Clicking it sends the final message text to the shared speech (text-to-speech) service and plays the audio in the browser. It is a play-on-demand action, not a real-time voice mode.
Configuration
plugins:
- module: codumentor.plugins.read_aloud
class: ReadAloudPlugin
# args:
# enabled: true # (default)
Parameters
- enabled (optional): Whether the plugin is active and exposes the action (default:
true)
The plugin has no other settings of its own — it relies on the top-level shared speech: configuration block (the same one the Telegram voice replies use):
speech:
enabled: true
base_url: "https://api.openai.com/v1"
api_key: "${OPENAI_API_KEY}"
tts_model: "tts-1"
tts_voice: "alloy"
How It Works
The plugin adds a custom x-read-aloud-action element to the message-actions row (next to the copy button) and exposes a small HTTP API under /ui/plugins/read_aloud:
GET /status— reports whether TTS is available (requiresspeech.enabledplus a resolvablebase_urlandapi_key). The button renders disabled with a tooltip when it isn't.POST /speak— synthesises the supplied text (as MP3, for browser<audio>playback) via the shared speech service.
There are no agent tools and no turn hooks — the action is driven entirely from the UI.
Notes
- Requirements:
speech.enabled: trueand anapi_keythat resolves to a real value via an env var. A per-user${secret:…}key cannot resolve for this call (it runs outside an agent turn), so the action stays disabled in that case. - Only the final assistant message is read — never intermediate tool-call narration.
- One message plays at a time; starting another stops the previous one.
- The speech service is shared, so changes to the
speech:block affect read-aloud and Telegram voice together.