refactor(frontend): rename project to s2s-frontend
This commit is contained in:
+2
-2
@@ -38,8 +38,8 @@ node_modules/
|
|||||||
.npm/
|
.npm/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
!speech_to_speech/package-lock.json
|
!speech_to_speech/package-lock.json
|
||||||
!frontend-s2s/package-lock.json
|
!s2s-frontend/package-lock.json
|
||||||
frontend-s2s/.eslintcache
|
s2s-frontend/.eslintcache
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ documentation, source identifiers, comments, and internal instructions use Engli
|
|||||||
|
|
||||||
| Component | Purpose |
|
| Component | Purpose |
|
||||||
|---|---|
|
|---|---|
|
||||||
| [frontend-s2s](frontend-s2s) | React, TypeScript, and Tailwind browser UI, served by Vite with hot reload |
|
| [s2s-frontend](s2s-frontend) | React, TypeScript, and Tailwind browser UI, served by Vite with hot reload |
|
||||||
| [s2s-client](s2s-client) | FastAPI backend, realtime WebSocket proxy, search and ApiPilot bridges; retained static client |
|
| [s2s-client](s2s-client) | FastAPI backend, realtime WebSocket proxy, search and ApiPilot bridges; retained static client |
|
||||||
| [speech_to_speech](speech_to_speech) | Queue-driven VAD, speech recognition, language model, and speech synthesis pipeline |
|
| [speech_to_speech](speech_to_speech) | Queue-driven VAD, speech recognition, language model, and speech synthesis pipeline |
|
||||||
| [s2s-reasoning-engine](s2s-reasoning-engine) | Optional Node-RED HTTP reasoning and conversation logging flows |
|
| [s2s-reasoning-engine](s2s-reasoning-engine) | Optional Node-RED HTTP reasoning and conversation logging flows |
|
||||||
@@ -34,7 +34,7 @@ Leave `SPEECH_TO_SPEECH_URL` unset to use the same-origin speech proxy.
|
|||||||
The launcher requires Python 3 with venv support, Node.js 22.18+ on the 22.x
|
The launcher requires Python 3 with venv support, Node.js 22.18+ on the 22.x
|
||||||
line or Node.js 24+, npm, Bash 4.4+, `setsid`, and `curl`. For staging hostnames,
|
line or Node.js 24+, npm, Bash 4.4+, `setsid`, and `curl`. For staging hostnames,
|
||||||
set `S2S_DEV_ALLOWED_HOSTS` and forward the Vite HMR WebSocket through the existing
|
set `S2S_DEV_ALLOWED_HOSTS` and forward the Vite HMR WebSocket through the existing
|
||||||
HTTPS reverse proxy. See [development setup](frontend-s2s/README.md).
|
HTTPS reverse proxy. See [development setup](s2s-frontend/README.md).
|
||||||
|
|
||||||
The existing Docker image still serves the retained static client. To build it,
|
The existing Docker image still serves the retained static client. To build it,
|
||||||
use the repository root as the Docker build context so documentation is included:
|
use the repository root as the Docker build context so documentation is included:
|
||||||
|
|||||||
+10
-10
@@ -1,6 +1,6 @@
|
|||||||
# Client architecture
|
# Client architecture
|
||||||
|
|
||||||
The [React browser client](../../frontend-s2s) uses the
|
The [React browser client](../../s2s-frontend) uses the
|
||||||
[FastAPI backend](../../s2s-client) for HTTP APIs and a speech WebSocket relay.
|
[FastAPI backend](../../s2s-client) for HTTP APIs and a speech WebSocket relay.
|
||||||
`start_ui.sh` serves Vite on the existing public port `8420` and FastAPI on
|
`start_ui.sh` serves Vite on the existing public port `8420` and FastAPI on
|
||||||
loopback port `8421`. Vite forwards backend routes and provides hot reload;
|
loopback port `8421`. Vite forwards backend routes and provides hot reload;
|
||||||
@@ -44,13 +44,13 @@ audio. It is not an unconditional byte-for-byte tunnel.
|
|||||||
|---|---|
|
|---|---|
|
||||||
| [server.py](../../s2s-client/server.py) | Configuration, static serving, WebSocket relay, context loading, ApiPilot, reasoning, search, queue and usage routes |
|
| [server.py](../../s2s-client/server.py) | Configuration, static serving, WebSocket relay, context loading, ApiPilot, reasoning, search, queue and usage routes |
|
||||||
| [start_ui.sh](../../start_ui.sh) | Dependency setup, ports, readiness, reload processes, and shutdown |
|
| [start_ui.sh](../../start_ui.sh) | Dependency setup, ports, readiness, reload processes, and shutdown |
|
||||||
| [vite.config.ts](../../frontend-s2s/vite.config.ts) | Public development endpoint, HMR, allowed hosts, and backend routing |
|
| [vite.config.ts](../../s2s-frontend/vite.config.ts) | Public development endpoint, HMR, allowed hosts, and backend routing |
|
||||||
| [App.tsx](../../frontend-s2s/src/App.tsx) | React layout, voice controls, dialogs, profile and reports sidebar |
|
| [App.tsx](../../s2s-frontend/src/App.tsx) | React layout, voice controls, dialogs, profile and reports sidebar |
|
||||||
| [controller.ts](../../frontend-s2s/src/realtime/controller.ts) | Application state, settings, context, queue, tools and external reasoning |
|
| [controller.ts](../../s2s-frontend/src/realtime/controller.ts) | Application state, settings, context, queue, tools and external reasoning |
|
||||||
| [client.ts](../../frontend-s2s/src/realtime/client.ts) | Realtime protocol, session lifecycle, audio and transcript events |
|
| [client.ts](../../s2s-frontend/src/realtime/client.ts) | Realtime protocol, session lifecycle, audio and transcript events |
|
||||||
| [components](../../frontend-s2s/src/components) | Chat, account, settings and voice components |
|
| [components](../../s2s-frontend/src/components) | Chat, account, settings and voice components |
|
||||||
| [audio](../../frontend-s2s/src/audio) | TypeScript capture/playback worklets, PCM codec, and visualizer |
|
| [audio](../../s2s-frontend/src/audio) | TypeScript capture/playback worklets, PCM codec, and visualizer |
|
||||||
| [legacy-theme.css](../../frontend-s2s/src/styles/legacy-theme.css) | Retained themes and responsive visual styles alongside Tailwind |
|
| [legacy-theme.css](../../s2s-frontend/src/styles/legacy-theme.css) | Retained themes and responsive visual styles alongside Tailwind |
|
||||||
| [auth.py](../../s2s-client/auth.py) | Hugging Face OAuth and caller identity/tier |
|
| [auth.py](../../s2s-client/auth.py) | Hugging Face OAuth and caller identity/tier |
|
||||||
| [limiter.py](../../s2s-client/limiter.py) | SQLite daily talk-time reservations and reconciliation |
|
| [limiter.py](../../s2s-client/limiter.py) | SQLite daily talk-time reservations and reconciliation |
|
||||||
| [flows.json](../../s2s-reasoning-engine/flows.json) | Node-RED reasoning and assistant-response logging |
|
| [flows.json](../../s2s-reasoning-engine/flows.json) | Node-RED reasoning and assistant-response logging |
|
||||||
@@ -82,11 +82,11 @@ usage; its static responses retain the existing no-cache headers.
|
|||||||
|
|
||||||
1. The browser captures microphone audio with echo cancellation, noise
|
1. The browser captures microphone audio with echo cancellation, noise
|
||||||
suppression and automatic gain-control settings.
|
suppression and automatic gain-control settings.
|
||||||
2. [mic-capture.worklet.ts](../../frontend-s2s/src/audio/mic-capture.worklet.ts) resamples to 16 kHz
|
2. [mic-capture.worklet.ts](../../s2s-frontend/src/audio/mic-capture.worklet.ts) resamples to 16 kHz
|
||||||
mono PCM16. The browser sends base64 `input_audio_buffer.append` frames.
|
mono PCM16. The browser sends base64 `input_audio_buffer.append` frames.
|
||||||
3. The backend processes VAD → STT → LLM → TTS and emits realtime events.
|
3. The backend processes VAD → STT → LLM → TTS and emits realtime events.
|
||||||
4. Assistant PCM16 audio at the current 16 kHz protocol rate is decoded and sent to
|
4. Assistant PCM16 audio at the current 16 kHz protocol rate is decoded and sent to
|
||||||
[audio-playback.worklet.ts](../../frontend-s2s/src/audio/audio-playback.worklet.ts), which buffers,
|
[audio-playback.worklet.ts](../../s2s-frontend/src/audio/audio-playback.worklet.ts), which buffers,
|
||||||
resamples and fades playback edges. Input speech can clear playback for barge-in.
|
resamples and fades playback edges. Input speech can clear playback for barge-in.
|
||||||
|
|
||||||
Audio worklets are loaded through `AudioWorklet.addModule`; keep their processor
|
Audio worklets are loaded through `AudioWorklet.addModule`; keep their processor
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ the script, values in that file can replace variables supplied on the command li
|
|||||||
Use Node.js 22.18+ on the 22.x line or Node.js 24+, npm, Python 3 with venv,
|
Use Node.js 22.18+ on the 22.x line or Node.js 24+, npm, Python 3 with venv,
|
||||||
Bash 4.4+, `setsid`, and `curl`. Remote staging access also needs the exact
|
Bash 4.4+, `setsid`, and `curl`. Remote staging access also needs the exact
|
||||||
hostname in `S2S_DEV_ALLOWED_HOSTS`, HTTPS, and WebSocket forwarding for speech
|
hostname in `S2S_DEV_ALLOWED_HOSTS`, HTTPS, and WebSocket forwarding for speech
|
||||||
and Vite HMR. See [frontend development setup](../../frontend-s2s/README.md).
|
and Vite HMR. See [frontend development setup](../../s2s-frontend/README.md).
|
||||||
|
|
||||||
To install and start the backend manually:
|
To install and start the backend manually:
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ S2S_PROXY_TARGET=ws://localhost:8765/v1/realtime \
|
|||||||
--host 127.0.0.1 --port 8421 --reload --reload-dir s2s-client
|
--host 127.0.0.1 --port 8421 --reload --reload-dir s2s-client
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, in a second terminal, run `cd frontend-s2s`, `npm ci`, and `npm run dev`.
|
Then, in a second terminal, run `cd s2s-frontend`, `npm ci`, and `npm run dev`.
|
||||||
|
|
||||||
Open <http://localhost:8420/>, tap the orb/microphone control, grant microphone
|
Open <http://localhost:8420/>, tap the orb/microphone control, grant microphone
|
||||||
access, and speak. Microphone access requires HTTPS or a local browser origin;
|
access, and speak. Microphone access requires HTTPS or a local browser origin;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ FastAPI server and retained static voice-chat UI for an OpenAI Realtime-compatib
|
|||||||
speech-to-speech backend. The browser streams microphone audio over WebSocket,
|
speech-to-speech backend. The browser streams microphone audio over WebSocket,
|
||||||
plays assistant audio, displays transcripts, and offers Spanish controls.
|
plays assistant audio, displays transcripts, and offers Spanish controls.
|
||||||
|
|
||||||
The root `start_ui.sh` now serves the [React frontend](../frontend-s2s) with
|
The root `start_ui.sh` now serves the [React frontend](../s2s-frontend) with
|
||||||
Vite on public port `8420`, proxying backend requests here on loopback port
|
Vite on public port `8420`, proxying backend requests here on loopback port
|
||||||
`8421`. This directory's static UI remains available when FastAPI is run
|
`8421`. This directory's static UI remains available when FastAPI is run
|
||||||
directly or through the existing Docker image.
|
directly or through the existing Docker image.
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ variables, which are exposed to browser code.
|
|||||||
## Staging with hot reload
|
## Staging with hot reload
|
||||||
|
|
||||||
PM2 can continue running the root `start_ui.sh` as its existing `s2s_ui` process.
|
PM2 can continue running the root `start_ui.sh` as its existing `s2s_ui` process.
|
||||||
Ensure the Node/npm versions above are on PM2's PATH and deploy `frontend-s2s`
|
Ensure the Node/npm versions above are on PM2's PATH and deploy `s2s-frontend`
|
||||||
alongside `s2s-client` and `docs`. The reverse proxy still targets port `8420`.
|
alongside `s2s-client` and `docs`. The reverse proxy still targets port `8420`.
|
||||||
|
|
||||||
Set the exact public hostname in the root `.env`, without scheme or port:
|
Set the exact public hostname in the root `.env`, without scheme or port:
|
||||||
@@ -74,7 +74,7 @@ Start FastAPI on `127.0.0.1:8421` as described in the
|
|||||||
[client usage guide](../docs/client/usage.md), then run:
|
[client usage guide](../docs/client/usage.md), then run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd frontend-s2s
|
cd s2s-frontend
|
||||||
npm ci
|
npm ci
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
+1
-1
@@ -64,7 +64,7 @@ async function waitForFile(filename: string) {
|
|||||||
|
|
||||||
async function launcher(context: TestContext, env: Record<string, string> = {}) {
|
async function launcher(context: TestContext, env: Record<string, string> = {}) {
|
||||||
const root = await mkdtemp(join(tmpdir(), "s2s-launcher-"));
|
const root = await mkdtemp(join(tmpdir(), "s2s-launcher-"));
|
||||||
const frontend = join(root, "frontend-s2s");
|
const frontend = join(root, "s2s-frontend");
|
||||||
const modules = join(frontend, "node_modules");
|
const modules = join(frontend, "node_modules");
|
||||||
await mkdir(join(root, ".venv/bin"), { recursive: true });
|
await mkdir(join(root, ".venv/bin"), { recursive: true });
|
||||||
await mkdir(join(root, "s2s-client"));
|
await mkdir(join(root, "s2s-client"));
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend-s2s",
|
"name": "s2s-frontend",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "frontend-s2s",
|
"name": "s2s-frontend",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dompurify": "^3.4.16",
|
"dompurify": "^3.4.16",
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend-s2s",
|
"name": "s2s-frontend",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
+3
-3
@@ -4,7 +4,7 @@ set -euo pipefail
|
|||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
VENV_DIR="$ROOT_DIR/.venv"
|
VENV_DIR="$ROOT_DIR/.venv"
|
||||||
REQ_FILE="$ROOT_DIR/s2s-client/requirements.txt"
|
REQ_FILE="$ROOT_DIR/s2s-client/requirements.txt"
|
||||||
FRONTEND_DIR="$ROOT_DIR/frontend-s2s"
|
FRONTEND_DIR="$ROOT_DIR/s2s-frontend"
|
||||||
if [ -f "$ROOT_DIR/.env" ]; then
|
if [ -f "$ROOT_DIR/.env" ]; then
|
||||||
set -a
|
set -a
|
||||||
source "$ROOT_DIR/.env"
|
source "$ROOT_DIR/.env"
|
||||||
@@ -28,7 +28,7 @@ for required_command in python3 node npm setsid curl; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if ! node -e 'const [major, minor] = process.versions.node.split(".").map(Number); process.exit((major === 22 && minor >= 18) || major >= 24 ? 0 : 1)'; then
|
if ! node -e 'const [major, minor] = process.versions.node.split(".").map(Number); process.exit((major === 22 && minor >= 18) || major >= 24 ? 0 : 1)'; then
|
||||||
echo "Error: frontend-s2s requires Node.js 22.18+ on the 22.x line, or Node.js 24+."
|
echo "Error: s2s-frontend requires Node.js 22.18+ on the 22.x line, or Node.js 24+."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ fi
|
|||||||
if [ ! -f "$FRONTEND_DIR/node_modules/vite/bin/vite.js" ] || \
|
if [ ! -f "$FRONTEND_DIR/node_modules/vite/bin/vite.js" ] || \
|
||||||
! cmp -s "$FRONTEND_DIR/package-lock.json" "$FRONTEND_DIR/node_modules/.s2s-package-lock.json" || \
|
! cmp -s "$FRONTEND_DIR/package-lock.json" "$FRONTEND_DIR/node_modules/.s2s-package-lock.json" || \
|
||||||
! cmp -s "$FRONTEND_DIR/package.json" "$FRONTEND_DIR/node_modules/.s2s-package.json"; then
|
! cmp -s "$FRONTEND_DIR/package.json" "$FRONTEND_DIR/node_modules/.s2s-package.json"; then
|
||||||
echo "Installing frontend dependencies from frontend-s2s/package-lock.json..."
|
echo "Installing frontend dependencies from s2s-frontend/package-lock.json..."
|
||||||
npm --prefix "$FRONTEND_DIR" ci --include=dev
|
npm --prefix "$FRONTEND_DIR" ci --include=dev
|
||||||
cp "$FRONTEND_DIR/package-lock.json" "$FRONTEND_DIR/node_modules/.s2s-package-lock.json"
|
cp "$FRONTEND_DIR/package-lock.json" "$FRONTEND_DIR/node_modules/.s2s-package-lock.json"
|
||||||
cp "$FRONTEND_DIR/package.json" "$FRONTEND_DIR/node_modules/.s2s-package.json"
|
cp "$FRONTEND_DIR/package.json" "$FRONTEND_DIR/node_modules/.s2s-package.json"
|
||||||
|
|||||||
Reference in New Issue
Block a user