Repository navigation
feat(web): read any chat message aloud in one click - #532
Merged
Merged
Conversation
A speaker button on every question and answer reads it through POST /voice/speak, the configured speech model and the voice picked in Settings, else the browser's speech. One message at a time, long answers in pieces under every provider's limit with the next prefetched, audio kept in the page so replays cost nothing. Each call is a model.speech row in the activity ledger. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0113pz5KMp2GDme1G4WqJbAo
17 of 23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: only voice mode read answers aloud; a message already in a conversation could not be played.
After: every question and answer in the web chat has a speaker button. One click reads it aloud by the speech model and the voice picked in Settings → AI assistant → Voice (else the browser's own speech); another click stops it. One message plays at a time (starting another stops the first, and so does leaving the conversation). Long answers go in pieces of at most 1,500 characters, cut after a sentence, under every provider's limit, and the next piece is asked for while one plays. Each piece's audio is kept in the page (32 most recent), so playing a message again doesn't call the speech model again.
How:
useReadAloud()inlib/voice.tssits besideuseVoice()and uses the samePOST /voice/speak,speakable()text cleaning andGET /voiceserver check, so the provider layer, the voice picker's choice and themodel.speechrow in the activity ledger are voice mode's; no backend change.ReadAloud(components/chat/read-aloud.tsx) is the button, inAnswer's action row andUserBubble's hover buttons.Motivation and Context
Adeel: "Allow playing audio via tts model of any message in chat interface".
Types of changes
Checklist:
make hookschecks it on commit).__tests__/chat-read-aloud.test.tsx, 7 tests;chat.test.tsxmocks next-auth now thatUserBubblereaches the API client).docs/accordingly (docs/assistant.md"Read a message aloud",docs/requirements.mdrow, README, DEVLOG).## UnreleasedinCHANGELOG.md.Local CI (
ci/local-ci.sh --jobs frontend,pre-commit,title): all three pass;mkdocs build --strictclean;make requirementspasses.Done questions (AGENTS.md)
POST /voice/speakwith{text, voice?}, which this uses unchanged.model.speechledger row viaspeech.speak, under budgets as before.docs/requirements.mdwith its checks.speech.pyprovider layer,/voice/speak,speakable(),askServer(),IconButton; no new code where existing fit.Generated by Claude Code