demo mount to fastapi
This commit is contained in:
@@ -39,29 +39,48 @@ examples/webpage/
|
||||
|
||||
## Run
|
||||
|
||||
1. Start the engine (default port `8001`):
|
||||
1. Start the engine (default port `8000`):
|
||||
|
||||
```bash
|
||||
cd AI-VideoAssistant-engine-v5-pipecat-minimal
|
||||
source .venv/bin/activate
|
||||
export OPENAI_API_KEY=...
|
||||
uvicorn engine.main:app --host 127.0.0.1 --port 8001
|
||||
uvicorn engine.main:app --host 127.0.0.1 --port 8000
|
||||
```
|
||||
|
||||
2. In another terminal, serve the page from a port that's on the
|
||||
engine's CORS allow-list (see `config.json`). The default config
|
||||
allows `http://localhost:8080`:
|
||||
2. Open the demo page served by the same process:
|
||||
|
||||
```bash
|
||||
cd AI-VideoAssistant-engine-v5-pipecat-minimal/examples/webpage
|
||||
python -m http.server 8080
|
||||
```text
|
||||
http://127.0.0.1:8000/demo/
|
||||
```
|
||||
|
||||
3. Open <http://localhost:8080> in Chrome, Edge, or Safari.
|
||||
- Click **Connect** (uses `ws://127.0.0.1:8001/ws-product` by default).
|
||||
- Pick a microphone if needed, click **Enable mic**, and start
|
||||
speaking. The browser will prompt for microphone access on first
|
||||
use. Device names may appear only after permission is granted.
|
||||
The default websocket URL is derived from the page host
|
||||
(`ws://127.0.0.1:8000/ws-product`). Click **Connect**, pick a
|
||||
microphone if needed, click **Enable mic**, and start speaking.
|
||||
|
||||
Mount path and on/off are controlled in `config.json`:
|
||||
|
||||
```json
|
||||
"server": {
|
||||
"serve_webpage": true,
|
||||
"webpage_mount": "/demo"
|
||||
}
|
||||
```
|
||||
|
||||
Set `"serve_webpage": false` in production if you serve the UI elsewhere.
|
||||
|
||||
### Standalone static server (optional)
|
||||
|
||||
You can still serve the files from another port for UI-only iteration.
|
||||
Add that origin to `server.cors_origins` in `config.json` if needed:
|
||||
|
||||
```bash
|
||||
cd AI-VideoAssistant-engine-v5-pipecat-minimal/examples/webpage
|
||||
python -m http.server 8080
|
||||
```
|
||||
|
||||
Then open <http://localhost:8080> and point the URL field at
|
||||
`ws://127.0.0.1:8000/ws-product`.
|
||||
|
||||
> The browser's mic API requires a secure context. `http://localhost`
|
||||
> qualifies; if you serve from another host, use HTTPS and a `wss://`
|
||||
|
||||
Reference in New Issue
Block a user