feat(geminiLive): restore systemInstruction in setup frame
This commit is contained in:
parent
2b1a354791
commit
9a62fba0f2
2 changed files with 11 additions and 9 deletions
|
|
@ -214,13 +214,16 @@ function tryParseGeminiJson(data: unknown): GeminiServerMessage | null {
|
|||
* `realtimeInputConfig.automaticActivityDetection` sont volontairement
|
||||
* retirés tant que `setupComplete` n'est pas confirmé en prod.
|
||||
*/
|
||||
function buildSetupFrame(): string {
|
||||
function buildSetupFrame(systemPrompt: string): string {
|
||||
return JSON.stringify({
|
||||
setup: {
|
||||
model: `models/${GEMINI_LIVE_MODEL}`,
|
||||
generationConfig: {
|
||||
responseModalities: ["AUDIO"],
|
||||
},
|
||||
systemInstruction: {
|
||||
parts: [{ text: systemPrompt }],
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -256,12 +259,10 @@ export function openGeminiLiveSession(
|
|||
|
||||
const timeoutMs = opts.timeoutMs ?? T2_SESSION_TIMEOUT_MS;
|
||||
const warningMs = opts.warningMs ?? T2_SESSION_WARNING_MS;
|
||||
// Conservé en signature pour usage futur (réintégration `systemInstruction`).
|
||||
const _systemPrompt = buildT2SystemPrompt({
|
||||
const systemPrompt = buildT2SystemPrompt({
|
||||
role: opts.role,
|
||||
contexte: opts.contexte,
|
||||
});
|
||||
void _systemPrompt;
|
||||
|
||||
const url = `${GEMINI_LIVE_URL}?key=${apiKey}`;
|
||||
const factory =
|
||||
|
|
@ -312,7 +313,7 @@ export function openGeminiLiveSession(
|
|||
|
||||
geminiWs.on("open", () => {
|
||||
console.log("[T2] Gemini WS open");
|
||||
const frame = buildSetupFrame();
|
||||
const frame = buildSetupFrame(systemPrompt);
|
||||
console.log("[T2] Gemini setup frame:", frame);
|
||||
try {
|
||||
geminiWs.send(frame);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue