Sprint 6d — Migrate Gemini Live to @google/genai SDK

feat(geminiLive): rewrite with GoogleGenAI SDK (vertexai: true, apiKey)
  replaces raw WebSocket to generativelanguage.googleapis.com
feat(geminiLive): restore full setup config (systemInstruction,
  inputAudioTranscription, outputAudioTranscription, VAD)
fix(geminiLive): buildSetupFrame → SDK config object (no manual JSON)
fix(useT2LiveSession): cancelTokenRef for idempotent startDialogue,
  closeAllRef for stable unmount cleanup
chore: add @google/genai@^1.50.1 dependency
test: 11 geminiLive tests rewritten with SDK mock
  292/292 backend tests green
This commit is contained in:
Hermann_Kitio 2026-04-27 02:25:58 +03:00
parent d89b0b1e89
commit 0662e766d4
6 changed files with 970 additions and 331 deletions

View file

@ -230,8 +230,8 @@ export async function runT2LiveCorrection(args: {
}
export interface CreateT2LiveRoutesOptions {
/** Injection pour les tests : fabrique de WebSocket vers Gemini. */
geminiFactory?: OpenGeminiLiveSessionOptions["geminiFactory"];
/** Injection pour les tests : fabrique de client SDK Gemini (Sprint 6d). */
clientFactory?: OpenGeminiLiveSessionOptions["clientFactory"];
/** Injection pour les tests : override timeout/warning. */
timeoutMs?: number;
warningMs?: number;
@ -313,7 +313,7 @@ export default function createT2LiveRoutes(
openGeminiLiveSession(adapter, {
role: sujetNonNull.role!,
contexte: sujetNonNull.contexte!,
geminiFactory: opts.geminiFactory,
clientFactory: opts.clientFactory,
timeoutMs: opts.timeoutMs,
warningMs: opts.warningMs,
onSessionEnd: async (transcript) => {