Build speech-to-text into the bridge; add droplet deployment examples
STT_PROVIDER now defaults to "builtin": Whisper (onnx-community/whisper-base, q8) runs in the bridge process on the CPU via @huggingface/transformers, so no provider account is needed and recordings stay on the bridge host. Silent captures are detected by level before the model runs. The external OpenAI-compatible adapter remains available. Tests: 130 unit/integration; 4 scenarios with the real model on a real speech recording (npm run test:real-stt). Not tested on audio from the glasses or on a droplet. deploy/ and docs/deploy-droplet.md are examples that have not been run. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -7,11 +7,13 @@ import type { HermesAdapter } from './hermes/adapter.ts';
|
||||
import { HermesRunsAdapter } from './hermes/runsAdapter.ts';
|
||||
import { buildServer } from './server.ts';
|
||||
import { NoSttAdapter, type SttAdapter } from './stt/adapter.ts';
|
||||
import { BuiltinWhisperStt } from './stt/builtinWhisper.ts';
|
||||
import { OpenAiCompatibleStt } from './stt/openaiCompatible.ts';
|
||||
import { TurnEngine, type EngineLog, type EngineTiming } from './turns.ts';
|
||||
|
||||
export interface Bridge {
|
||||
app: FastifyInstance;
|
||||
stt: SttAdapter;
|
||||
db: Db;
|
||||
devices: Devices;
|
||||
engine: TurnEngine;
|
||||
@@ -35,6 +37,9 @@ export function sttFromConfig(config: BridgeConfig): SttAdapter {
|
||||
if (config.stt.provider === 'openai-compatible') {
|
||||
return new OpenAiCompatibleStt({ baseUrl: config.stt.baseUrl, apiKey: config.stt.apiKey, model: config.stt.model });
|
||||
}
|
||||
if (config.stt.provider === 'builtin') {
|
||||
return new BuiltinWhisperStt({ model: config.stt.model, dtype: config.stt.dtype, cacheDir: config.stt.cacheDir });
|
||||
}
|
||||
return new NoSttAdapter();
|
||||
}
|
||||
|
||||
@@ -70,6 +75,7 @@ export async function createBridge(
|
||||
|
||||
return {
|
||||
app,
|
||||
stt,
|
||||
db,
|
||||
devices,
|
||||
engine,
|
||||
|
||||
Reference in New Issue
Block a user