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,26 +294,31 @@ export function openGeminiLiveSession(
|
||||||
};
|
};
|
||||||
|
|
||||||
// ── Ouverture de la session SDK ──────────────────────────────────────
|
// ── Ouverture de la session SDK ──────────────────────────────────────
|
||||||
|
const sdkConfig = {
|
||||||
|
responseModalities: [Modality.AUDIO],
|
||||||
|
systemInstruction: systemPrompt,
|
||||||
|
inputAudioTranscription: {},
|
||||||
|
outputAudioTranscription: {},
|
||||||
|
realtimeInputConfig: {
|
||||||
|
automaticActivityDetection: {
|
||||||
|
disabled: false,
|
||||||
|
startOfSpeechSensitivity: StartSensitivity.START_SENSITIVITY_LOW,
|
||||||
|
endOfSpeechSensitivity: EndSensitivity.END_SENSITIVITY_LOW,
|
||||||
|
silenceDurationMs: 2000,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("[T2] SDK config:", JSON.stringify(sdkConfig, null, 2));
|
||||||
|
console.log("[T2] SDK model:", GEMINI_LIVE_MODEL);
|
||||||
|
|
||||||
ai.live
|
ai.live
|
||||||
.connect({
|
.connect({
|
||||||
model: GEMINI_LIVE_MODEL,
|
model: GEMINI_LIVE_MODEL,
|
||||||
config: {
|
config: sdkConfig,
|
||||||
responseModalities: [Modality.AUDIO],
|
|
||||||
systemInstruction: systemPrompt,
|
|
||||||
inputAudioTranscription: {},
|
|
||||||
outputAudioTranscription: {},
|
|
||||||
realtimeInputConfig: {
|
|
||||||
automaticActivityDetection: {
|
|
||||||
disabled: false,
|
|
||||||
startOfSpeechSensitivity: StartSensitivity.START_SENSITIVITY_LOW,
|
|
||||||
endOfSpeechSensitivity: EndSensitivity.END_SENSITIVITY_LOW,
|
|
||||||
silenceDurationMs: 2000,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
callbacks: {
|
callbacks: {
|
||||||
onopen: () => {
|
onopen: () => {
|
||||||
console.log("[T2] Session Gemini ouverte (SDK)");
|
console.log("[T2] Gemini SDK onopen");
|
||||||
// Démarrer les timers une fois la session effectivement ouverte.
|
// Démarrer les timers une fois la session effectivement ouverte.
|
||||||
warningTimer = setTimeout(() => {
|
warningTimer = setTimeout(() => {
|
||||||
if (sessionEnded) return;
|
if (sessionEnded) return;
|
||||||
|
|
@ -334,13 +339,14 @@ export function openGeminiLiveSession(
|
||||||
}, timeoutMs);
|
}, timeoutMs);
|
||||||
},
|
},
|
||||||
onmessage: (msg: LiveServerMessage) => {
|
onmessage: (msg: LiveServerMessage) => {
|
||||||
|
console.log(
|
||||||
|
"[T2] Gemini SDK message:",
|
||||||
|
JSON.stringify(msg).substring(0, 200),
|
||||||
|
);
|
||||||
handleSdkMessage(msg);
|
handleSdkMessage(msg);
|
||||||
},
|
},
|
||||||
onerror: (err: unknown) => {
|
onerror: (err: unknown) => {
|
||||||
console.log(
|
console.log("[T2] Gemini SDK error:", JSON.stringify(err));
|
||||||
"[T2] Erreur SDK :",
|
|
||||||
err instanceof Error ? err.message : String(err),
|
|
||||||
);
|
|
||||||
if (!sessionEnded) {
|
if (!sessionEnded) {
|
||||||
clearTimers();
|
clearTimers();
|
||||||
sessionEnded = true;
|
sessionEnded = true;
|
||||||
|
|
@ -351,8 +357,8 @@ export function openGeminiLiveSession(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onclose: () => {
|
onclose: (e: unknown) => {
|
||||||
console.log("[T2] Session Gemini fermée (SDK)");
|
console.log("[T2] Gemini SDK close:", JSON.stringify(e));
|
||||||
if (!sessionEnded) {
|
if (!sessionEnded) {
|
||||||
clearTimers();
|
clearTimers();
|
||||||
try {
|
try {
|
||||||
|
|
@ -368,10 +374,7 @@ export function openGeminiLiveSession(
|
||||||
session = s;
|
session = s;
|
||||||
})
|
})
|
||||||
.catch((err: unknown) => {
|
.catch((err: unknown) => {
|
||||||
console.log(
|
console.error("[T2] SDK connect error:", err);
|
||||||
"[T2] live.connect a échoué :",
|
|
||||||
err instanceof Error ? err.message : String(err),
|
|
||||||
);
|
|
||||||
sessionEnded = true;
|
sessionEnded = true;
|
||||||
clearTimers();
|
clearTimers();
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue