Skip to content

refactor: remove conditional voice mode support from backend and frontend#8597

Merged
ogabrielluiz merged 5 commits into
mainfrom
fix-audio-deps-update
Jun 18, 2025
Merged

refactor: remove conditional voice mode support from backend and frontend#8597
ogabrielluiz merged 5 commits into
mainfrom
fix-audio-deps-update

Conversation

@ogabrielluiz
Copy link
Copy Markdown
Contributor

@ogabrielluiz ogabrielluiz commented Jun 17, 2025

Summary by CodeRabbit

  • New Features

    • The voice assistant button is now always visible in the chat input, regardless of previous configuration settings.
  • Refactor

    • Removed the configuration option and related state for enabling/disabling voice mode from both backend and frontend.
    • Simplified the voice assistant logic and configuration response by eliminating the voice mode enabled flag.
  • Bug Fixes

    • Improved reliability of voice assistant availability by removing dependency on dynamic backend checks.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 17, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This change removes conditional support for "voice mode" across both backend and frontend. All checks, imports, and state related to whether voice mode is enabled are eliminated. The API, schemas, frontend state, and UI now assume voice mode is always present, with related toggles and detection logic removed.

Changes

File(s) Change Summary
src/backend/base/langflow/api/router.py,
src/backend/base/langflow/api/v1/__init__.py
Voice mode router import and inclusion made unconditional; try-except blocks removed.
src/backend/base/langflow/api/utils.py Removed the get_voice_mode_enabled() function.
src/backend/base/langflow/api/v1/endpoints.py Removed import and usage of get_voice_mode_enabled; /config endpoint no longer returns this key.
src/backend/base/langflow/api/v1/schemas.py Removed voice_mode_enabled field from ConfigResponse model.
src/backend/base/langflow/api/v1/voice_mode.py Deferred webrtcvad import to a helper function; refactored VoiceConfig and related logic.
src/frontend/src/controllers/API/queries/config/use-get-config.ts Removed voice_mode_enabled from config interface and related state update logic.
src/frontend/src/modals/IOModal/components/chatView/chatInput/components/voice-assistant/components/voice-button.tsx Removed conditional rendering based on voiceModeEnabled; button always renders.
src/frontend/src/stores/flowsManagerStore.ts,
src/frontend/src/types/zustand/flowsManager/index.ts
Removed voiceModeEnabled property and setter from store and type definitions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend

    User->>Frontend: Loads application
    Frontend->>Backend: GET /config
    Backend-->>Frontend: Config (no voice_mode_enabled flag)
    Frontend->>Frontend: Renders VoiceButton unconditionally
    User->>Frontend: Clicks VoiceButton
    Frontend->>Backend: Initiates voice-related API/WebSocket
    Backend-->>Frontend: Handles voice mode features (no enablement check)
Loading

Possibly related PRs

  • langflow-ai/langflow#8561: Adds conditional voice mode support and UI toggling, which is directly affected and reversed by the current PR.
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch fix-audio-deps-update

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 17, 2025
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 17, 2025
@coderabbitai coderabbitai Bot changed the title @coderabbitai refactor: remove conditional voice mode support from backend and frontend Jun 17, 2025
@github-actions github-actions Bot added the refactor Maintenance tasks and housekeeping label Jun 17, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (1)
src/backend/base/langflow/api/v1/endpoints.py (1)

747-755: Config response no longer filtered – verify sensitive/irrelevant fields aren’t leaking

settings_service.settings.model_dump() dumps the entire settings object.
With voice_mode_enabled gone this blob has grown relatively. Please confirm that the model does not contain secrets (API keys, DB URLs, etc.) or environment-specific info that shouldn’t be exposed over /config.

If any such data exists, export only the whitelisted subset:

-        return {
-            "feature_flags": FEATURE_FLAGS,
-            **settings_service.settings.model_dump(),
-        }
+        safe_settings = settings_service.settings.model_dump(include={
+            "frontend_timeout",
+            "auto_saving",
+            "auto_saving_interval",
+            "health_check_max_retries",
+            "max_file_size_upload",
+            "webhook_polling_interval",
+            "serialization_max_items_length",
+            "event_delivery",
+        })
+        return {"feature_flags": FEATURE_FLAGS, **safe_settings}
🧹 Nitpick comments (1)
src/backend/base/langflow/api/v1/voice_mode.py (1)

159-164: Add explicit return-type annotation for the new property

Minor readability / typing nit:

-    def barge_in_enabled(self):
+    def barge_in_enabled(self) -> bool:
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fcb500 and dde563c.

📒 Files selected for processing (10)
  • src/backend/base/langflow/api/router.py (2 hunks)
  • src/backend/base/langflow/api/utils.py (0 hunks)
  • src/backend/base/langflow/api/v1/__init__.py (2 hunks)
  • src/backend/base/langflow/api/v1/endpoints.py (1 hunks)
  • src/backend/base/langflow/api/v1/schemas.py (0 hunks)
  • src/backend/base/langflow/api/v1/voice_mode.py (4 hunks)
  • src/frontend/src/controllers/API/queries/config/use-get-config.ts (1 hunks)
  • src/frontend/src/modals/IOModal/components/chatView/chatInput/components/voice-assistant/components/voice-button.tsx (0 hunks)
  • src/frontend/src/stores/flowsManagerStore.ts (0 hunks)
  • src/frontend/src/types/zustand/flowsManager/index.ts (0 hunks)
💤 Files with no reviewable changes (5)
  • src/backend/base/langflow/api/v1/schemas.py
  • src/frontend/src/modals/IOModal/components/chatView/chatInput/components/voice-assistant/components/voice-button.tsx
  • src/frontend/src/types/zustand/flowsManager/index.ts
  • src/backend/base/langflow/api/utils.py
  • src/frontend/src/stores/flowsManagerStore.ts
⏰ Context from checks skipped due to timeout of 90000ms (40)
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 32/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 40/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 37/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 35/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 39/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 28/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 29/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 30/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 31/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 38/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 36/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 27/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 34/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 33/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 25/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 24/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 23/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 26/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 17/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 21/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 13/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 22/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 14/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 9/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 15/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 18/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 10/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 12/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 19/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 8/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 1/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 11/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 2/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 16/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 5/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 4/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 20/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 6/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 3/40
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 7/40
🔇 Additional comments (2)
src/backend/base/langflow/api/v1/__init__.py (1)

17-18: Same startup-failure risk as in router.py

Make the import optional or document websockets, numpy, etc. as hard requirements; otherwise deployments that never use voice mode will crash.

Replicate the guarded import pattern suggested in router.py.

Also applies to: 36-37

src/frontend/src/controllers/API/queries/config/use-get-config.ts (1)

48-69: LGTM – front-end consumer cleaned up correctly

All references to the removed voice_mode_enabled flag are gone, and state setters stay in sync with the updated ConfigResponse.
No concerns here.

Comment thread src/backend/base/langflow/api/router.py
Comment thread src/backend/base/langflow/api/v1/voice_mode.py
@github-actions github-actions Bot added refactor Maintenance tasks and housekeeping and removed refactor Maintenance tasks and housekeeping labels Jun 18, 2025
@ogabrielluiz ogabrielluiz added this pull request to the merge queue Jun 18, 2025
Merged via the queue into main with commit 6ada07a Jun 18, 2025
66 checks passed
@ogabrielluiz ogabrielluiz deleted the fix-audio-deps-update branch June 18, 2025 12:34
@ogabrielluiz ogabrielluiz mentioned this pull request Jun 18, 2025
ogabrielluiz added a commit to bkatya2001/langflow that referenced this pull request Jun 24, 2025
…tend (langflow-ai#8597)

* revert changes that made voice mode conditional to the presence of webrtcvad

* refactor: lazy-load webrtcvad dependency

* refactor: remove try-except block and directly import voice_mode_router

* [autofix.ci] apply automated fixes

* feat: add LRU caching to voice activity detector initialization

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor Maintenance tasks and housekeeping size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR: webrtcvad [BUG] Unable to install langflow - Failed to build webrtcvad==2.0.10

2 participants