Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 8 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# This file is intentionally documentation-only.
#
# Integrated LexVoice runs should not configure frontend variables here.
# Use `../lex-voice/.env` as the single source of truth; `lex-voice/run.sh`
# injects LiveKit, room-input, input-source, role-device, agent, media, and
# debug settings into the frontend process when it starts `make start_ui`.
# Use the LexVoice repository `.env` as the single source of truth; its `run.sh`
# injects LiveKit, room-input, input-source, role-device, agent, media, and debug
# settings into the frontend process when it starts `make start_ui`.
#
# Only create `agent-starter-react/.env.local` for standalone frontend
# development where this repository is launched directly with `pnpm dev`.
# In that case, define only the variables needed for that standalone run.

# For sandbox gateway deployment, see the LexVoice repository's
# `deploy/liveavatar_gateway/env.example`; copy that reference file to
# `deploy/liveavatar_gateway/.env` inside the LexVoice repository to configure
# a deployed gateway.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
# testing
/coverage

# Legacy sandbox gateway artifacts from pre-migration local runs
/.sandbox-gateway/
/logs/direct-proxy.log
/logs/sandbox-gateway*.log
/logs/sandbox-gateway.pid

# next.js
/.next/
/out/
Expand Down
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,27 @@ Run the following command to automatically clone this template.
lk app create --template agent-starter-react
```

For integrated LexVoice runs, configure `../lex-voice/.env` and start the
frontend through the LexVoice runtime scripts. `../lex-voice/run.sh` injects
LiveKit, room-input, input-source, role-device, agent, media, and debug settings
into this Next.js process.
For integrated LexVoice runs, configure the LexVoice repository `.env` and start
the frontend through the LexVoice runtime scripts. The LexVoice repository's
`run.sh` injects LiveKit, room-input, input-source, role-device, agent, media,
and debug settings into this Next.js process.

The session lifecycle API keeps start/stop state in memory, so integrated
deployments should route `/api/session/*` to a single Next.js instance or sticky routing.
If you replace the custom connection details endpoint, it must echo the requested
`sessionId` and derive the same room name so dispatch and stop calls coordinate
with the connected room.

### LiveAvatar Gateway Deployments

Sandbox-backed public deployments are owned by the LexVoice repository. Set
`LIVEAVATAR_USE_SANDBOX=1` in the LexVoice repository `.env` and configure
broker, template, warm pool, and `SANDBOX_ENV_*` values in the LexVoice repository's
`deploy/liveavatar_gateway/.env`.

This frontend repository only runs the Next.js UI. It does not create, release,
or warm sandbox sessions.

For standalone frontend development, install dependencies and run the dev
server directly:

Expand All @@ -78,8 +88,8 @@ pnpm dev

And open http://localhost:3000 in your browser.

You'll also need a LiveKit server and an agent worker. In this workspace, those
are normally provided by the sibling `../lex-voice` project.
You'll also need a LiveKit server and an agent worker. In integrated workspaces,
those are normally provided by the LexVoice project.

## Configuration

Expand Down Expand Up @@ -118,7 +128,7 @@ You can update these values in [`app-config.ts`](./app-config.ts) to customize b

#### Environment Variables

Integrated runs should keep runtime variables in `../lex-voice/.env`; this
Integrated runs should keep runtime variables in the LexVoice repository `.env`; this
repository's `.env.example` is documentation-only. Only create
`agent-starter-react/.env.local` for standalone frontend development launched
directly with `pnpm dev`.
Expand All @@ -130,7 +140,7 @@ LIVEKIT_URL=https://your-livekit-server-url
```

The frontend defaults to the browser camera/microphone input when no input
source is provided. Configure `INPUT_SOURCE` only in `../lex-voice/.env` for
source is provided. Configure `INPUT_SOURCE` only in the LexVoice repository `.env` for
integrated backend runs. The LiveKit variables above are required for
standalone voice agent functionality to work with your LiveKit project.

Expand Down
2 changes: 1 addition & 1 deletion next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
allowedDevOrigins: ['liveavatar.lexmount.cn'],
allowedDevOrigins: ['liveavatar.local.lexmount.net'],
};

export default nextConfig;
4 changes: 3 additions & 1 deletion tests/project-config.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ test('README matches the documented LexVoice environment source', async () => {
const envExample = await readFile('.env.example', 'utf8');

assert.match(envExample, /documentation-only/);
assert.match(readme, /\.\.\/lex-voice\/\.env/);
assert.match(readme, /LexVoice repository `\.env`/);
assert.doesNotMatch(readme, /\blex-voice\b/);
assert.doesNotMatch(envExample, /\blex-voice\b/);
assert.match(readme, /single Next\.js instance or sticky routing/);
assert.match(readme, /custom connection details endpoint/);
assert.match(readme, /sessionId/);
Expand Down
Loading