mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
AIX: Gemini Interactions: terminate on error
This commit is contained in:
@@ -5,6 +5,7 @@ import type { ChatGenerateParseFunction } from '../chatGenerate.dispatch';
|
|||||||
import type { IParticleTransmitter } from './IParticleTransmitter';
|
import type { IParticleTransmitter } from './IParticleTransmitter';
|
||||||
|
|
||||||
import { GeminiInteractionsWire_API_Interactions } from '../../wiretypes/gemini.interactions.wiretypes';
|
import { GeminiInteractionsWire_API_Interactions } from '../../wiretypes/gemini.interactions.wiretypes';
|
||||||
|
import { IssueSymbols } from '../ChatGenerateTransmitter';
|
||||||
import { geminiConvertPCM2WAV } from './gemini.audioutils';
|
import { geminiConvertPCM2WAV } from './gemini.audioutils';
|
||||||
|
|
||||||
|
|
||||||
@@ -218,11 +219,16 @@ export function createGeminiInteractionsParserSSE(requestedModelName: string | n
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'error':
|
case 'error':
|
||||||
// Observed mid-stream with an empty payload between content blocks - non-fatal, the stream
|
// Two observed shapes:
|
||||||
// continues with further events and eventually an interaction.complete. Silent-skip empty
|
// 1) Empty payload mid-stream (Beta noise): the stream continues with further events and
|
||||||
// payloads (Beta noise); warn only when actual error info is present.
|
// eventually an interaction.complete - silent-skip.
|
||||||
if (event.error?.message || event.error?.code)
|
// 2) Populated payload with message/code: terminal upstream error (also how Gemini reports
|
||||||
console.warn('[GeminiInteractions] SSE error event:', event.error);
|
// cancelled interactions: HTTP 500 to the cancel call + an error SSE on the stream).
|
||||||
|
// Surface as a dialect-terminating issue so the UI renders it and the stream ends cleanly.
|
||||||
|
if (event.error?.message || event.error?.code) {
|
||||||
|
const errorText = `${event.error.code ? `${event.error.code}: ` : ''}${event.error.message || 'Upstream error.'}`;
|
||||||
|
pt.setDialectTerminatingIssue(errorText, IssueSymbols.Generic, 'srv-warn');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
Reference in New Issue
Block a user