Skip to content

feat: Add Text-to-Speech VoiceOutput component (Fixes #311)#507

Open
Ixotic27 wants to merge 10 commits into
AditthyaSS:mainfrom
Ixotic27:feat/tts-output
Open

feat: Add Text-to-Speech VoiceOutput component (Fixes #311)#507
Ixotic27 wants to merge 10 commits into
AditthyaSS:mainfrom
Ixotic27:feat/tts-output

Conversation

@Ixotic27

@Ixotic27 Ixotic27 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description - Adds a native Web Speech API Text-to-Speech VoiceOutput component with an animated visualizer. It is displayed under the output in the AgentRunner. Fixes #311. %0A## Pillar - New Features %0A## Checklist - Tested locally

Summary by CodeRabbit

  • New Features

    • Read-aloud for completed agent results (appears after output, before rating) with Play/Stop controls, playback state, and graceful fallback when browser speech synthesis is unavailable.
    • Sanitizes text for speaking (omits code blocks/markdown) and selects preferred English voices; UI updates on start/end/errors.
  • Style

    • Animated sound-wave visualizer during playback with a reduced-motion accessibility override.

Copilot AI review requested due to automatic review settings June 9, 2026 04:01
@Ixotic27 Ixotic27 requested a review from AditthyaSS as a code owner June 9, 2026 04:01
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

@Ixotic27 is attempting to deploy a commit to the aditthyass' projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "issues"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Adds a VoiceOutput React component (browser speechSynthesis) with play/stop controls and animated visualizer, integrates it into AgentRunner to render for completed non-streaming outputs, and adds related CSS animations with a reduced-motion override.

Changes

Voice Output for Agent Results

Layer / File(s) Summary
VoiceOutput component structure and voice initialization
src/components/VoiceOutput.jsx
Component setup with React hooks, refs for speechSynthesis and utterance, playback/voice state, and useEffect to load voices and register onvoiceschanged.
VoiceOutput playback and lifecycle handlers
src/components/VoiceOutput.jsx
handlePlay resumes paused speech or restarts; sanitizes text (removes markdown/code blocks); creates SpeechSynthesisUtterance; selects preferred English voice and sets rate/pitch; attaches onstart/onend/onerror; handleStop cancels speech; feature-detects speechSynthesis.
VoiceOutput rendering and animation styling
src/components/VoiceOutput.jsx, src/index.css
Renders "Read Aloud" / "Stop" controls with a bar-based animated visualizer while playing. CSS adds @keyframes sound-wave, .animate-sound-wave, and a prefers-reduced-motion: reduce override.
AgentRunner integration
src/components/AgentRunner.jsx
Imports VoiceOutput and renders <VoiceOutput text={output} /> when non-streaming output is available, placed before RunRating.

Sequence Diagram

sequenceDiagram
  participant User
  participant AgentRunner
  participant VoiceOutput
  participant SpeechSynthesis
  User->>AgentRunner: view agent result (output)
  AgentRunner->>VoiceOutput: render(text={output})
  User->>VoiceOutput: click "Read Aloud"
  VoiceOutput->>SpeechSynthesis: create Utterance & speak(utterance)
  SpeechSynthesis-->>VoiceOutput: onstart
  SpeechSynthesis-->>VoiceOutput: onend / onerror
  VoiceOutput->>SpeechSynthesis: cancel() on stop or cleanup
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • AditthyaSS
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning PR implements text-to-speech with animated visualizer [#311] but lacks speech-to-text (microphone input) functionality which was a core objective. Add speech-to-text component to enable users to speak instead of typing, completing the full conversational voice I/O requirement from issue #311.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a Text-to-Speech VoiceOutput component that was requested in issue #311.
Out of Scope Changes check ✅ Passed All changes (VoiceOutput component, animations, AgentRunner integration) are directly scoped to implementing TTS functionality requested in issue #311.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@mergify

mergify Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Hey @Ixotic27! 👋
Wow — your first contribution to iloveAgents! This is a big deal and I want you to know it means a lot. 🎊
Every agent on this platform started exactly like this — someone like you deciding to spend their time building something useful for everyone. That is something to be proud of.
A few things while you wait for the review:

  • Star the repo if you haven't already. Star it here
  • 📖 Check the Contributing Guide
  • 💬 Drop a comment if you get stuck — I reply within 24 hours
    Can't wait to ship this with you. 🚀
    Welcome to the iloveAgents family. 🙏
    @AditthyaSS

@mergify mergify Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Build is failing on this PR.
Please fix before merging:

  1. Run npm run build locally
  2. Fix any errors shown
  3. Push your fix — the check will re-run automatically
    Most common issue: broken registry import.
    Replace:
    import agents from '../agents/registry'
    With:
    import { useAgents } from '../lib/useAgents'
    const { agents } = useAgents()
    See CONTRIBUTING.md for help. 🙏

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a “Read Aloud” voice output feature using the Web Speech API, including an animated audio visualizer, and wires it into the main agent output UI.

Changes:

  • Added VoiceOutput React component to speak generated output via speechSynthesis.
  • Added CSS keyframes + utility class for the visualizer animation.
  • Integrated VoiceOutput into AgentRunner beneath the agent output.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
src/index.css Adds sound-wave keyframes and .animate-sound-wave animation used by the visualizer.
src/components/VoiceOutput.jsx Introduces the read-aloud UI and speech synthesis logic with an animated visualizer.
src/components/AgentRunner.jsx Renders VoiceOutput using the current output text.
Comments suppressed due to low confidence (1)

src/components/VoiceOutput.jsx:1

  • Using Math.random() during render makes animation durations change on every re-render, which can cause visual “popping” and unnecessary style churn (and can also create hydration mismatches if SSR is introduced later). Precompute stable durations once (e.g., via useMemo/useRef) so re-renders don’t re-randomize timings.
import { useState, useEffect, useRef } from "react";

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/VoiceOutput.jsx
Comment thread src/components/VoiceOutput.jsx
Comment thread src/components/VoiceOutput.jsx
Comment thread src/components/VoiceOutput.jsx
Comment thread src/components/VoiceOutput.jsx
Comment thread src/components/VoiceOutput.jsx
Comment thread src/components/VoiceOutput.jsx
@mergify

mergify Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Hey @Ixotic27! This PR has a merge conflict that needs to be resolved before we can review or merge it.
Please sync your branch with the latest main and fix the conflicts.
Need help? Check out resolving merge conflicts.
@AditthyaSS

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/index.css (1)

195-197: ⚡ Quick win

Respect reduced-motion preference for the infinite visualizer animation.

Line 196 runs endlessly with no prefers-reduced-motion fallback.

💡 Proposed fix
 .animate-sound-wave {
   animation: sound-wave 1s ease-in-out infinite;
 }
+
+@media (prefers-reduced-motion: reduce) {
+  .animate-sound-wave {
+    animation: none;
+    height: 60%;
+  }
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/index.css` around lines 195 - 197, The infinite animation on
.animate-sound-wave should respect the user's reduced-motion preference; update
the CSS to add a prefers-reduced-motion media query that disables or removes the
animation for .animate-sound-wave (e.g., set animation: none or
animation-play-state: paused inside `@media` (prefers-reduced-motion: reduce)) so
the sound-wave keyframes are not played for users who prefer reduced motion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/index.css`:
- Around line 195-197: The infinite animation on .animate-sound-wave should
respect the user's reduced-motion preference; update the CSS to add a
prefers-reduced-motion media query that disables or removes the animation for
.animate-sound-wave (e.g., set animation: none or animation-play-state: paused
inside `@media` (prefers-reduced-motion: reduce)) so the sound-wave keyframes are
not played for users who prefer reduced motion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3aa82cc1-93cc-4cdf-a878-68145a77fe61

📥 Commits

Reviewing files that changed from the base of the PR and between 3e83cfe and 93b652e.

📒 Files selected for processing (3)
  • src/components/AgentRunner.jsx
  • src/components/VoiceOutput.jsx
  • src/index.css

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 9, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 9, 2026
@mergify

mergify Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ This branch is out of date with main.
Please click "Update branch" to sync before merging.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
iloveagents Ready Ready Preview, Comment Jun 16, 2026 5:46pm

@Ixotic27

Copy link
Copy Markdown
Contributor Author

@AditthyaSS merge it

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Immersive Voice Interaction (Speech-to-Text & TTS)

3 participants