Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Voice Mode API with WebSocket support and VAD processing for real-time audio interaction #6826

Draft
wants to merge 58 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
294b498
WIP
phact Nov 13, 2024
5f6833f
works
phact Nov 13, 2024
931052d
stereo
phact Nov 14, 2024
99d5f64
ui v0
phact Nov 14, 2024
8bd3f2d
unnecessary import
phact Nov 14, 2024
e2163ae
Merge branch 'main' into voice_mode
phact Nov 15, 2024
dca19cd
update steps in voice ws
phact Nov 15, 2024
c2f15fe
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 15, 2024
2863d48
unused
phact Nov 20, 2024
e97e561
merge
phact Nov 20, 2024
c4773b7
Merge branch 'voice_mode' of github.com:phact/langflow into voice_mode
phact Nov 20, 2024
b48837a
Merge branch 'main' into voice_mode
phact Nov 20, 2024
86755db
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 20, 2024
de727ca
Merge branch 'main' into voice_mode
phact Nov 22, 2024
5b8c4bd
Merge branch 'voice_mode' of github.com:phact/langflow into voice_mode
phact Nov 25, 2024
824d3fd
Merge branch 'langflow-ai:main' into voice_mode
phact Nov 25, 2024
86a630c
cleanly handle missing OPENAI key
phact Nov 25, 2024
968baa3
ruff
phact Nov 25, 2024
4fa7b2e
Merge branch 'main' into voice_mode
phact Nov 25, 2024
3d77aed
Merge branch 'main' into voice_mode
phact Nov 27, 2024
47a18ab
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 27, 2024
d3d2c8a
Merge branch 'main' into voice_mode
phact Dec 3, 2024
d75d9d8
fix genericIconComponent path
phact Dec 3, 2024
9e443b3
merge main
phact Jan 6, 2025
0f40fb9
update for recent async fixes
phact Jan 7, 2025
28b6101
Merge branch 'main' into voice_mode
phact Jan 7, 2025
55aad4d
accidentally commited html file
phact Jan 10, 2025
d41cb0c
better prompt and threading
phact Jan 28, 2025
d3d425f
client barge-in detection
phact Jan 28, 2025
baa855f
fmt
phact Jan 28, 2025
be9c40d
error handling
phact Jan 28, 2025
bee04ea
fixed VAD with 24 to 16Hz resampling
phact Jan 31, 2025
edfc435
comment out debug file
phact Feb 1, 2025
eae0a9d
better_vad
phact Feb 4, 2025
9b1059f
lock
phact Feb 4, 2025
ab6711d
merge
phact Feb 4, 2025
7b5f6d3
router
phact Feb 4, 2025
3d174bd
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 4, 2025
2dc9ad1
mcp fixes
phact Feb 5, 2025
4843119
timeout fix
phact Feb 5, 2025
7c12985
Merge remote-tracking branch 'refs/remotes/phact/voice_mode' into voi…
phact Feb 5, 2025
4a11a82
global variable exception handling
phact Feb 5, 2025
b008fcf
don't close the websocket
phact Feb 5, 2025
41f7db6
fix double send bug
phact Feb 6, 2025
762fca6
fix double send bug
phact Feb 6, 2025
78bc7f1
response.output_item event type typo
phact Feb 6, 2025
c616465
voice_mode logging
phact Feb 6, 2025
e797175
vad + dummy check
phact Feb 14, 2025
d105850
✨ (frontend): Add voice assistant feature to chat input component
Cristhianzl Feb 24, 2025
0386ccb
✨ (api-key-popup.tsx): Add a new component ApiKeyPopup to enable user…
Cristhianzl Feb 24, 2025
c3b1f8e
merge fix
Cristhianzl Feb 24, 2025
b57decf
merge fix
Cristhianzl Feb 25, 2025
3fd1f51
Merge branch 'main' into cz/voice_mode
Cristhianzl Feb 25, 2025
5362efb
✨ (Voice Assistant): Introduce voice transcription feature powered by…
Cristhianzl Feb 25, 2025
07ce8f3
✨ (voice-assistant.tsx): Add voice assistant feature to the chat inpu…
Cristhianzl Feb 25, 2025
2cff383
♻️ (use-interrupt-playback.ts): refactor useInterruptPlayback hook to…
Cristhianzl Feb 25, 2025
42eb9bc
🔧 (gitattributes): add *.raw file extension as binary to prevent git …
Cristhianzl Feb 26, 2025
6cfeee8
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ Dockerfile text
*.svg binary
*.csv binary
*.wav binary
*.raw binary
Binary file added output_audio.raw
Binary file not shown.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ dependencies = [
"crewai==0.102.0",
"mcp>=0.9.1",
"uv>=0.5.7",
"webrtcvad>=2.0.10",
"scipy>=1.14.1",
"ag2>=0.1.0",
"scrapegraph-py>=1.12.0",
"pydantic-ai>=0.0.19",
Expand Down
4 changes: 4 additions & 0 deletions src/backend/base/langflow/api/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
flows_router,
folders_router,
login_router,
mcp_router,
monitor_router,
starter_projects_router,
store_router,
users_router,
validate_router,
variables_router,
voice_mode_router,
)
from langflow.api.v2 import files_router as files_router_v2

Expand All @@ -39,5 +41,7 @@
router.include_router(monitor_router)
router.include_router(folders_router)
router.include_router(starter_projects_router)
router.include_router(voice_mode_router)
router.include_router(mcp_router)

router_v2.include_router(files_router_v2)
2 changes: 2 additions & 0 deletions src/backend/base/langflow/api/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from langflow.api.v1.users import router as users_router
from langflow.api.v1.validate import router as validate_router
from langflow.api.v1.variable import router as variables_router
from langflow.api.v1.voice_mode import router as voice_mode_router

__all__ = [
"api_key_router",
Expand All @@ -28,4 +29,5 @@
"users_router",
"validate_router",
"variables_router",
"voice_mode_router",
]
8 changes: 5 additions & 3 deletions src/backend/base/langflow/api/v1/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

logger.debug("MCP module loaded - debug logging enabled")

enable_progress_notifications = None

router = APIRouter(prefix="/mcp", tags=["mcp"])

Expand Down Expand Up @@ -177,10 +178,11 @@


@server.call_tool()
async def handle_call_tool(
name: str, arguments: dict, *, enable_progress_notifications: bool = Depends(get_enable_progress_notifications)
) -> list[types.TextContent]:
async def handle_call_tool(name: str, arguments: dict) -> list[types.TextContent]:
"""Handle tool execution requests."""
global enable_progress_notifications

Check failure on line 183 in src/backend/base/langflow/api/v1/mcp.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.13)

Ruff (PLW0603)

src/backend/base/langflow/api/v1/mcp.py:183:12: PLW0603 Using the global statement to update `enable_progress_notifications` is discouraged
if enable_progress_notifications is None:
enable_progress_notifications = get_settings_service().settings.mcp_server_enable_progress_notifications
try:
session = await anext(get_session())
background_tasks = BackgroundTasks()
Expand Down
Loading
Loading