chore(geminiLive): add detailed SDK logging for Render debug
This commit is contained in:
parent
0662e766d4
commit
be2b325c4b
1 changed files with 28 additions and 25 deletions
|
|
@ -294,10 +294,7 @@ export function openGeminiLiveSession(
|
|||
};
|
||||
|
||||
// ── Ouverture de la session SDK ──────────────────────────────────────
|
||||
ai.live
|
||||
.connect({
|
||||
model: GEMINI_LIVE_MODEL,
|
||||
config: {
|
||||
const sdkConfig = {
|
||||
responseModalities: [Modality.AUDIO],
|
||||
systemInstruction: systemPrompt,
|
||||
inputAudioTranscription: {},
|
||||
|
|
@ -310,10 +307,18 @@ export function openGeminiLiveSession(
|
|||
silenceDurationMs: 2000,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
console.log("[T2] SDK config:", JSON.stringify(sdkConfig, null, 2));
|
||||
console.log("[T2] SDK model:", GEMINI_LIVE_MODEL);
|
||||
|
||||
ai.live
|
||||
.connect({
|
||||
model: GEMINI_LIVE_MODEL,
|
||||
config: sdkConfig,
|
||||
callbacks: {
|
||||
onopen: () => {
|
||||
console.log("[T2] Session Gemini ouverte (SDK)");
|
||||
console.log("[T2] Gemini SDK onopen");
|
||||
// Démarrer les timers une fois la session effectivement ouverte.
|
||||
warningTimer = setTimeout(() => {
|
||||
if (sessionEnded) return;
|
||||
|
|
@ -334,13 +339,14 @@ export function openGeminiLiveSession(
|
|||
}, timeoutMs);
|
||||
},
|
||||
onmessage: (msg: LiveServerMessage) => {
|
||||
console.log(
|
||||
"[T2] Gemini SDK message:",
|
||||
JSON.stringify(msg).substring(0, 200),
|
||||
);
|
||||
handleSdkMessage(msg);
|
||||
},
|
||||
onerror: (err: unknown) => {
|
||||
console.log(
|
||||
"[T2] Erreur SDK :",
|
||||
err instanceof Error ? err.message : String(err),
|
||||
);
|
||||
console.log("[T2] Gemini SDK error:", JSON.stringify(err));
|
||||
if (!sessionEnded) {
|
||||
clearTimers();
|
||||
sessionEnded = true;
|
||||
|
|
@ -351,8 +357,8 @@ export function openGeminiLiveSession(
|
|||
}
|
||||
}
|
||||
},
|
||||
onclose: () => {
|
||||
console.log("[T2] Session Gemini fermée (SDK)");
|
||||
onclose: (e: unknown) => {
|
||||
console.log("[T2] Gemini SDK close:", JSON.stringify(e));
|
||||
if (!sessionEnded) {
|
||||
clearTimers();
|
||||
try {
|
||||
|
|
@ -368,10 +374,7 @@ export function openGeminiLiveSession(
|
|||
session = s;
|
||||
})
|
||||
.catch((err: unknown) => {
|
||||
console.log(
|
||||
"[T2] live.connect a échoué :",
|
||||
err instanceof Error ? err.message : String(err),
|
||||
);
|
||||
console.error("[T2] SDK connect error:", err);
|
||||
sessionEnded = true;
|
||||
clearTimers();
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue