57 lines
1.9 KiB
Markdown
57 lines
1.9 KiB
Markdown
# LiveKit Voice Assistant
|
|
|
|
This worker runs the Rocky Mountain Vending site voice assistant with LiveKit Agents and xAI realtime voice.
|
|
|
|
## Local development
|
|
|
|
1. Start the Next.js app:
|
|
`pnpm dev`
|
|
2. Start the LiveKit agent worker in a second terminal:
|
|
`pnpm voice-agent:dev`
|
|
3. Open the site and launch the voice bubble.
|
|
4. Run the automated regressions:
|
|
`pnpm voice-assistant:test:local`
|
|
5. Run the fake-microphone voice regression:
|
|
`pnpm voice-assistant:test:local:voice`
|
|
|
|
## Environment
|
|
|
|
The worker loads environment variables from:
|
|
- `.env.local`
|
|
- `.env.voice-agent.local` (optional override file)
|
|
|
|
Required variables:
|
|
- `LIVEKIT_URL`
|
|
- `LIVEKIT_API_KEY`
|
|
- `LIVEKIT_API_SECRET`
|
|
- `XAI_API_KEY`
|
|
- `XAI_REALTIME_MODEL=grok-4-1-fast-non-reasoning`
|
|
|
|
Recommended variable:
|
|
- `VOICE_ASSISTANT_SITE_URL`
|
|
|
|
## Production
|
|
|
|
Run the worker as a separate long-lived Node process:
|
|
|
|
`pnpm voice-agent:start`
|
|
|
|
Point `VOICE_ASSISTANT_SITE_URL` at the deployed Next.js app so the worker can reuse `/api/contact` and `/api/request-machine`.
|
|
|
|
## Verification
|
|
|
|
Automated checks:
|
|
- `pnpm voice-assistant:test:local`
|
|
- `pnpm voice-assistant:test:local:voice`
|
|
- `pnpm voice-assistant:test:live`
|
|
|
|
Manual spoken smoke checklist:
|
|
1. Open the homepage and launch the assistant bubble.
|
|
2. Press `Start assistant` and confirm the panel reaches `Text Ready` or `Listening`.
|
|
3. Confirm the text box is enabled before microphone access is granted.
|
|
4. Press `Enable microphone` and verify the browser permission prompt appears.
|
|
5. After granting permission, say a short question such as "What cities in Utah do you serve?"
|
|
6. Confirm you see a user transcript, then an assistant reply transcript.
|
|
7. Confirm spoken audio playback is audible after `Enable spoken replies` when the browser requires it.
|
|
8. Refresh the page and verify reconnect still works.
|
|
9. Open `/sign-in` and confirm the assistant stays hidden there.
|