diff --git a/src/app/components/chat/chat.component.ts b/src/app/components/chat/chat.component.ts index 75ae41e9..c03b9f18 100644 --- a/src/app/components/chat/chat.component.ts +++ b/src/app/components/chat/chat.component.ts @@ -505,8 +505,10 @@ export class ChatComponent implements OnInit, AfterViewInit, OnDestroy { } } else if (chunkJson.errorMessage) { this.processErrorMessage(chunkJson) - } else if (chunkJson.actions) { + } + if (chunkJson.actions) { this.processActionArtifact(chunkJson) + this.processActionStateDelta(chunkJson) } this.changeDetectorRef.detectChanges(); }, @@ -630,12 +632,18 @@ export class ChatComponent implements OnInit, AfterViewInit, OnDestroy { } private processActionArtifact(e: AdkEvent) { - if (e.actions && e.actions.artifactDelta) { + if (e.actions && e.actions.artifactDelta && Object.keys(e.actions.artifactDelta).length > 0) { this.storeEvents(null, e); this.storeMessage(null, e, 'bot'); } } + private processActionStateDelta(e: AdkEvent) { + if (e.actions && e.actions.stateDelta && Object.keys(e.actions.stateDelta).length > 0) { + this.currentSessionState = e.actions.stateDelta; + } + } + /** * Collapse consecutive text parts into a single part. Preserves relative * order of other parts. diff --git a/src/app/core/models/types.ts b/src/app/core/models/types.ts index ef968661..a1bd6eef 100644 --- a/src/app/core/models/types.ts +++ b/src/app/core/models/types.ts @@ -80,6 +80,7 @@ export declare interface LlmResponse { export declare interface EventActions { message?: string; artifactDelta?: any; + stateDelta?: any; functionCall?: FunctionCall; functionResponse?: FunctionResponse; finishReason?: string;