faster-whisper (small.en, GPU+CPU fallback) on CT 102 → POST /api/voice/transcribe (multer→whisper client) → mic in the bubble records (MediaRecorder), uploads, drops the transcript into the input to review-and-send. Infra scripts in deploy/whisper/. Retention (P2b) next. NOTE: mic needs a secure context (the https domain), not the LAN IP. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
25 lines
788 B
JavaScript
25 lines
788 B
JavaScript
import { describe, it, expect, beforeAll } from 'vitest';
|
|
import request from 'supertest';
|
|
import { createApp } from '../../server.js';
|
|
import { resetDb } from '../helpers/db.js';
|
|
import { migrateUp } from '../../lib/db/migrate.js';
|
|
|
|
let app;
|
|
const owner = { Authorization: 'Bearer test-token' };
|
|
beforeAll(async () => {
|
|
await resetDb(); await migrateUp();
|
|
process.env.OWNER_TOKEN = 'test-token';
|
|
app = createApp();
|
|
});
|
|
|
|
describe('voice transcribe route', () => {
|
|
it('401 without a token', async () => {
|
|
const res = await request(app).post('/api/voice/transcribe');
|
|
expect(res.status).toBe(401);
|
|
});
|
|
it('400 when no audio supplied', async () => {
|
|
const res = await request(app).post('/api/voice/transcribe').set(owner);
|
|
expect(res.status).toBe(400);
|
|
});
|
|
});
|