Spaces:
Running
Running
Commit
·
b7f4c65
1
Parent(s):
e821a83
rtc-config url
Browse files
examples/voice_agent_webrtc_langgraph/pipeline.py
CHANGED
|
@@ -446,12 +446,7 @@ async def get_prompt():
|
|
| 446 |
"description": "Prompt and persona are managed by the LangGraph agent.",
|
| 447 |
}
|
| 448 |
|
| 449 |
-
#
|
| 450 |
-
UI_DIST_DIR = Path(__file__).parent / "ui" / "dist"
|
| 451 |
-
if UI_DIST_DIR.exists():
|
| 452 |
-
app.mount("/", StaticFiles(directory=str(UI_DIST_DIR), html=True), name="static")
|
| 453 |
-
|
| 454 |
-
|
| 455 |
@app.get("/rtc-config")
|
| 456 |
async def rtc_config():
|
| 457 |
"""Expose browser RTC ICE configuration based on environment variables.
|
|
@@ -476,6 +471,12 @@ async def rtc_config():
|
|
| 476 |
return {"iceServers": ice_servers}
|
| 477 |
|
| 478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
if __name__ == "__main__":
|
| 480 |
parser = argparse.ArgumentParser(description="WebRTC demo")
|
| 481 |
parser.add_argument("--host", default="0.0.0.0", help="Host for HTTP server (default: localhost)")
|
|
|
|
| 446 |
"description": "Prompt and persona are managed by the LangGraph agent.",
|
| 447 |
}
|
| 448 |
|
| 449 |
+
# RTC config endpoint must be registered before mounting static at "/"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
@app.get("/rtc-config")
|
| 451 |
async def rtc_config():
|
| 452 |
"""Expose browser RTC ICE configuration based on environment variables.
|
|
|
|
| 471 |
return {"iceServers": ice_servers}
|
| 472 |
|
| 473 |
|
| 474 |
+
# Serve static UI (if bundled) after API/WebSocket routes so they still take precedence
|
| 475 |
+
UI_DIST_DIR = Path(__file__).parent / "ui" / "dist"
|
| 476 |
+
if UI_DIST_DIR.exists():
|
| 477 |
+
app.mount("/", StaticFiles(directory=str(UI_DIST_DIR), html=True), name="static")
|
| 478 |
+
|
| 479 |
+
|
| 480 |
if __name__ == "__main__":
|
| 481 |
parser = argparse.ArgumentParser(description="WebRTC demo")
|
| 482 |
parser.add_argument("--host", default="0.0.0.0", help="Host for HTTP server (default: localhost)")
|