browser-demo
Run, deploy, and modify the speech-to-speech browser demo, including WebSocket/WebRTC client modes, tools, search/camera flows, Hugging Face Space limits, and UI behavior.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- browser-demo
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Run, deploy, and modify the speech-to-speech browser demo, including WebSocket/WebRTC client modes, tools, search/camera flows, Hugging Face Space limits, and UI behavior.
- disable-model-invocation
- true
02 资源文件 25
- 资产文件assets/demo/.dockerignore95 B
- 脚本assets/demo/auth.py10.3 KB
- 资产文件assets/demo/Dockerfile345 B
- 资产文件assets/demo/docs/adr/0001-docker-space-with-search-proxy.md1.6 KB
- 资产文件assets/demo/index.html36.9 KB
- 脚本assets/demo/limiter.py11.1 KB
- 脚本assets/demo/main.js67.0 KB
- 资产文件assets/demo/requirements.txt166 B
- 脚本assets/demo/rtc/s2s-rtc-client.js36.1 KB
- 脚本assets/demo/server.py24.4 KB
- 资产文件assets/demo/style.css70.7 KB
- 脚本assets/demo/tool-call-batcher.js1.9 KB
- 脚本assets/demo/ui/account.js13.2 KB
- 脚本assets/demo/ui/chat.js27.4 KB
- 脚本assets/demo/ui/dom.js1.1 KB
- 脚本assets/demo/worklets/audio-playback.js5.1 KB
- 脚本assets/demo/worklets/mic-capture.js6.2 KB
- 脚本assets/demo/ws/codec.js1.8 KB
- 脚本assets/demo/ws/orb-visualizer.js3.6 KB
- 脚本assets/demo/ws/s2s-ws-client.js48.6 KB
- 脚本assets/demo/ws/user-audio-recorder.js7.0 KB
- 参考文档references/browser-client-behavior.md4.7 KB
- 参考文档references/demo-deployment.md5.0 KB
- 参考文档references/demo-ui-and-tools.md4.8 KB
- 参考文档references/troubleshooting.md4.4 KB
03 SKILL.md 正文
Browser demo
Use this sub-skill when the task is to run the browser voice UI, connect it to a
speech-to-speech backend, deploy it as a Space/container, debug browser audio
or transport selection, change demo tools/search/camera behavior, or preserve
UI design rules while editing the demo.
Route by task
- Start or deploy the demo server: read Demo deployment.
- Debug WebSocket/WebRTC browser connection, microphone, audio worklets, localStorage, or Docker hostnames: read Browser client behavior.
- Modify web search, camera snapshot, startup greeting, account/limits, or UI design: read Demo UI and tools.
- Diagnose user-facing demo failures: read Troubleshooting.
- Choose backend STT/LLM/TTS models for the server behind the demo: route to components-and-backends.
- Start the backend CLI or size
--num_pipelines: route to cli-and-server. - Debug raw Realtime events or WebRTC
/v1/realtime/calls: route to realtime-api.
Minimal local sequence
- Start a backend first, normally at
ws://localhost:8765/v1/realtime. - Install the bundled demo server requirements in the environment that will run the web app.
- From this sub-skill directory, set the backend URL and optional demo env vars:
python -m pip install -r assets/demo/requirements.txt
export SPEECH_TO_SPEECH_URL=ws://localhost:8765/v1/realtime
export SERPER_API_KEY=... # optional, enables server-side web search
export STARTUP_GREETING=... # optional; empty disables automatic greeting
uvicorn --app-dir assets/demo server:app --port 7860
- Open
http://localhost:7860/, click the orb, allow the microphone, and talk. Browsers require HTTPS or localhost for microphone/camera access.
High-signal demo rules
SPEECH_TO_SPEECH_URLis the highest-priority mode: the browser connects directly to the pinned Realtime URL, the settings URL is locked, load-balancer metering is off, and WebRTC can be offered.- User-entered direct URLs are WebSocket-only. WebRTC is disabled because the
same-origin
/api/callsproxy forwards only to an env-pinned URL. LOAD_BALANCER_URLmode is WebSocket-only and hides the backend URL from the browser. When also running on a Hugging Face Space withSPACE_ID, OAuth identity and daily time limits are active.- In Docker, WebSocket and WebRTC may require different backend hostnames: WebSocket is dialed by the browser; WebRTC SDP is proxied by the demo server.
- The UI color thesis is strict: saturated color belongs to the orb and tiny role echoes only. Do not add colored buttons, fills, or borders outside that system.
The detailed references above are self-contained so future agents can handle normal operation and edits without relying on the source demo files being present.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).