Use Mini 2 firmware audio processing and Scribe v3 Live
This commit is contained in:
+3
-1
@@ -31,11 +31,13 @@ test('settings and bounded history survive a restart', t => {
|
||||
const directory = mkdtempSync(join(tmpdir(), 'alice-store-'));
|
||||
t.after(() => rmSync(directory, { recursive: true }));
|
||||
const store = openStore(directory);
|
||||
const changed = validateSettings({ ...store.getSettings(), systemPrompt: ' Тест ' });
|
||||
assert.equal(store.getSettings().sttModel, 'scribe_v3_live');
|
||||
const changed = validateSettings({ ...store.getSettings(), sttModel: 'scribe_v2_realtime', systemPrompt: ' Тест ' });
|
||||
store.updateSettings(changed);
|
||||
for (let i = 0; i < 55; i++) store.recordTurn(String(i), 'Ответ');
|
||||
const reopened = openStore(directory);
|
||||
assert.equal(reopened.getSettings().systemPrompt, 'Тест');
|
||||
assert.equal(reopened.getSettings().sttModel, 'scribe_v2_realtime');
|
||||
assert.equal(reopened.getHistory().length, 50);
|
||||
assert.equal(reopened.getHistory()[0].user, '5');
|
||||
reopened.clearHistory();
|
||||
|
||||
+19
-5
@@ -9,6 +9,7 @@ test('voice turns stream dialogue and skip synthesis for confirmed quick actions
|
||||
const tts = new WebSocketServer({ port: 0 });
|
||||
await Promise.all([once(stt, 'listening'), once(tts, 'listening')]);
|
||||
process.env.ELEVENLABS_API_KEY = 'test';
|
||||
process.env.ELEVEN_STT_KEYTERMS = 'Aphex Twin, Boards of Canada';
|
||||
process.env.LLM_MODE = 'echo';
|
||||
process.env.ELEVEN_STT_URL = `ws://127.0.0.1:${stt.address().port}/stt`;
|
||||
process.env.ELEVEN_TTS_URL = `ws://127.0.0.1:${tts.address().port}/tts`;
|
||||
@@ -16,7 +17,10 @@ test('voice turns stream dialogue and skip synthesis for confirmed quick actions
|
||||
let transcript = 'Привет';
|
||||
let syntheses = 0;
|
||||
stt.on('connection', (ws, req) => {
|
||||
assert.equal(new URL(req.url, 'http://x').searchParams.get('commit_strategy'), 'manual');
|
||||
const params = new URL(req.url, 'http://x').searchParams;
|
||||
assert.equal(params.get('commit_strategy'), 'manual');
|
||||
assert.equal(params.get('model_id'), 'scribe_v3_live');
|
||||
assert.deepEqual(params.getAll('keyterms'), ['Aphex Twin', 'Boards of Canada']);
|
||||
ws.on('message', data => {
|
||||
const msg = JSON.parse(data);
|
||||
input = Buffer.concat([input, Buffer.from(msg.audio_base_64, 'base64')]);
|
||||
@@ -34,9 +38,9 @@ test('voice turns stream dialogue and skip synthesis for confirmed quick actions
|
||||
const { handleTurn } = await import('../server/turns.mjs');
|
||||
const local = new WebSocketServer({ port: 0 });
|
||||
await once(local, 'listening');
|
||||
const store = { getSettings: () => ({ sttModel: 'scribe_v2_realtime', ttsModel: 'eleven_v4_turbo', voiceId: 'voice', systemPrompt: '' }), getHistory: () => [], recordTurn: (...args) => { recorded = args; } };
|
||||
const store = { getSettings: () => ({ sttModel: 'scribe_v3_live', ttsModel: 'eleven_v4_turbo', voiceId: 'voice', systemPrompt: '' }), getHistory: () => [], recordTurn: (...args) => { recorded = args; } };
|
||||
local.on('connection', ws => handleTurn(ws, store));
|
||||
async function turn(reply) {
|
||||
async function turn(reply, wake = false) {
|
||||
const client = new WebSocket(`ws://127.0.0.1:${local.address().port}`);
|
||||
const seen = [], audio = [], calls = [];
|
||||
client.on('message', (data, binary) => {
|
||||
@@ -47,7 +51,7 @@ test('voice turns stream dialogue and skip synthesis for confirmed quick actions
|
||||
const msg = JSON.parse(data);
|
||||
seen.push(msg.type);
|
||||
if (msg.type === 'ready') {
|
||||
client.send(JSON.stringify({ type: 'start' }));
|
||||
client.send(JSON.stringify({ type: 'start', wake }));
|
||||
client.send(Buffer.from([5, 6, 7, 8]));
|
||||
client.send(JSON.stringify({ type: 'end' }));
|
||||
} else if (msg.type === 'device_tool') {
|
||||
@@ -74,7 +78,17 @@ test('voice turns stream dialogue and skip synthesis for confirmed quick actions
|
||||
assert.deepEqual(await turn({ accepted: true, status: 'paused' }), {
|
||||
seen: ['ready', 'transcript', 'device_tool', 'done'], audio: [], calls: [['spotify_control', { action: 'pause' }]],
|
||||
});
|
||||
assert.equal(syntheses, 1);
|
||||
assert.deepEqual(recorded, [transcript, 'Музыка на паузе.']);
|
||||
|
||||
transcript = 'Алиса, выключи музыку.';
|
||||
assert.deepEqual(await turn({ accepted: true, status: 'paused' }, true), {
|
||||
seen: ['ready', 'transcript', 'device_tool', 'done'], audio: [], calls: [['spotify_control', { action: 'pause' }]],
|
||||
});
|
||||
assert.deepEqual(recorded, ['выключи музыку.', 'Музыка на паузе.']);
|
||||
|
||||
transcript = 'Алиса.';
|
||||
assert.deepEqual(await turn(undefined, true), { seen: ['ready', 'done'], audio: [], calls: [] });
|
||||
assert.deepEqual(recorded, ['выключи музыку.', 'Музыка на паузе.']);
|
||||
assert.equal(syntheses, 1);
|
||||
await Promise.all([new Promise(r => local.close(r)), new Promise(r => stt.close(r)), new Promise(r => tts.close(r))]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user