mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
fix(voice): Gemini voice messages follow a language change
The Gemini session translated each status and error message once, when it happened, so after a language change the voice control kept showing it in the old language. The state event now also carries the English catalog text as sourceDetail, and the control words it when shown. The local server's known token errors stay catalog text until then instead of being translated on arrival.
This commit is contained in:
1 parent
962f7293c6
commit
b1c5de0ed1
5 files changed
+77
-8
No files matched your search
@@ -4,6 +4,7 @@ import { geminiSocketUrl } from './geminiSession.js';
|
||||
import { createVoiceSession } from './session.js';
|
||||
import { createPointerTracker } from './pointerContext.js';
|
||||
import { withToolCatalog } from './gevRealtime.js';
|
||||
import { setLocale, t } from '../i18n/index.js';
|
||||
import {
|
||||
harness,
|
||||
tick,
|
||||
@@ -3662,3 +3663,28 @@ test('a missing server key reaches the error state flagged, other token failures
|
||||
assert.equal(h.sockets.length, 0);
|
||||
}
|
||||
});
|
||||
|
||||
test('an error keeps its English catalog text beside the worded detail', async (t2) => {
|
||||
t2.after(() => setLocale('en'));
|
||||
setLocale('es');
|
||||
const h = harness({
|
||||
fetchImpl: async () =>
|
||||
Response.json(
|
||||
{ error: 'Gemini quota is unavailable. Try again later.' },
|
||||
{ status: 503 },
|
||||
),
|
||||
});
|
||||
await h.c.start();
|
||||
const error = h.events
|
||||
.filter((event) => event.type === 'state' && event.state === 'error')
|
||||
.at(-1);
|
||||
assert.equal(
|
||||
error.sourceDetail,
|
||||
'Gemini quota is unavailable. Try again later.',
|
||||
);
|
||||
assert.equal(
|
||||
error.detail,
|
||||
t('Gemini quota is unavailable. Try again later.'),
|
||||
);
|
||||
assert.notEqual(error.detail, error.sourceDetail);
|
||||
});
|
||||
Reference in new issue
Block a user