Skip to content

feat(chat): add read-aloud support for assistant messages - #94

Open
manar-alsayedali wants to merge 1 commit into
CopilotKit:mainfrom
manar-alsayedali:feat/read-aloud
Open

manar-alsayedali wants to merge 1 commit into
CopilotKit:mainfrom
manar-alsayedali:feat/read-aloud

Conversation

@manar-alsayedali

Copy link
Copy Markdown

What this changes

Adds an icon-only Read Aloud control beneath completed assistant messages in the main chat transcript, including first-day answers.

Clicking the speaker reads the message; clicking Stop cancels playback. Starting another message stops the previous one. Playback also stops when switching conversations, removing or replacing the message, or starting a new response. Speech never starts automatically.

The control uses the existing button and icon components, accessible labels, native tooltips, and keyboard support. Playback failures produce a visible, screen-reader-accessible alert. Controls are hidden during streaming and in unsupported browsers.

Implementation uses the browser’s native SpeechSynthesis API and the existing Markdown parser dependencies. Markdown is converted to speech text, omitting fenced code, raw HTML markup, and URL-only links. No dependencies, backend changes, API keys, or paid services are added.

Limitations

  • Group chat and voice-call integration are outside this change’s scope.
  • Speech quality and available voices depend on the browser and operating system.

Where it runs

  • Playback state is transient and browser-local, shared across mounted transcripts to coordinate the browser’s speech queue.
  • Server replicas are unaffected; no server state, serialization, or cross-process coordination is introduced.
  • No new browser event fan-out, network endpoints, ports, or schedules are introduced.

Boundary and audit

No agent actions, authorization boundaries, or server audit behavior change. Speech failures are handled locally in the UI; message text is not sent to an application TTS endpoint.

Changelog

No server deployment or configuration changes are required. This adds an optional browser-side message control.

Proof

  • 17 focused Read Aloud tests passed.
  • 191 relevant regression tests passed across 11 files, including the Read Aloud tests.
  • App TypeScript checks passed.
  • Biome formatting and lint checks passed for all five feature files.
  • git diff --check passed.
  • Manual browser testing completed successfully.

Tests cover playback switching, stale callbacks, cleanup, multiple transcript instances, streaming, unsupported browsers, errors, Markdown conversion, keyboard activation under Strict Mode, and the first-day assistant rendering path.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants