diff --git a/package.json b/package.json index 0e8e84e5..d7027907 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "test": "ng test", "clean-config": "node clean-backend.js", "inject-backend": "node set-backend.js", - "serve": "npm run clean-config && npm run inject-backend && ng serve" + "serve": "npm run clean-config && npm run inject-backend && ng serve --poll 1000" }, "private": true, "dependencies": { diff --git a/src/app/components/chat/chat.component.ts b/src/app/components/chat/chat.component.ts index ef013fdb..2d0b3ada 100644 --- a/src/app/components/chat/chat.component.ts +++ b/src/app/components/chat/chat.component.ts @@ -615,8 +615,8 @@ export class ChatComponent implements OnInit, AfterViewInit, OnDestroy { } if (e?.longRunningToolIds && e.longRunningToolIds.length > 0) { - this.getAsyncFunctionsFromParts(e.longRunningToolIds, e.content.parts); - const func = this.longRunningEvents[0]; + this.getAsyncFunctionsFromParts(e.longRunningToolIds, e.content.parts, e.invocationId); + const func = this.longRunningEvents[0].function; if (func.args.authConfig && func.args.authConfig.exchangedAuthCredential && func.args.authConfig.exchangedAuthCredential.oauth2) { @@ -874,11 +874,12 @@ export class ChatComponent implements OnInit, AfterViewInit, OnDestroy { const dialogRef = this.dialog.open(PendingEventDialogComponent, { width: '600px', data: { - event: this.longRunningEvents[0], + event: this.longRunningEvents[0].function, appName: this.appName, userId: this.userId, sessionId: this.sessionId, functionCallEventId: this.functionCallEventId, + invocationId: this.longRunningEvents[0].invocationId }, }); @@ -1028,10 +1029,10 @@ export class ChatComponent implements OnInit, AfterViewInit, OnDestroy { this.isVideoRecording = false; } - private getAsyncFunctionsFromParts(pendingIds: any[], parts: any[]) { + private getAsyncFunctionsFromParts(pendingIds: any[], parts: any[], invocationId: string) { for (const part of parts) { if (part.functionCall && pendingIds.includes(part.functionCall.id)) { - this.longRunningEvents.push(part.functionCall); + this.longRunningEvents.push({function: part.functionCall, invocationId: invocationId}); } } } diff --git a/src/app/components/pending-event-dialog/pending-event-dialog.component.ts b/src/app/components/pending-event-dialog/pending-event-dialog.component.ts index 975d8b25..94a4e245 100644 --- a/src/app/components/pending-event-dialog/pending-event-dialog.component.ts +++ b/src/app/components/pending-event-dialog/pending-event-dialog.component.ts @@ -79,6 +79,7 @@ export class PendingEventDialogComponent { 'role': 'user', 'parts': [], }, + invocationId: this.data.invocationId }; if (this.selectedEvent.response) { req.functionCallEventId = this.functionCallEventId; diff --git a/src/app/core/models/AgentRunRequest.ts b/src/app/core/models/AgentRunRequest.ts index 3018bf07..52ba2212 100644 --- a/src/app/core/models/AgentRunRequest.ts +++ b/src/app/core/models/AgentRunRequest.ts @@ -29,4 +29,5 @@ export interface AgentRunRequest { functionCallEventId?: string; streaming?: boolean; stateDelta?: any; + invocationId?: string; }