Fix edit confirmation re-submission.

- This broke in [this commit](7d13f24288 (diff-e257a7e5e02896371ce002da8963abdb91f5c77990d38e3d2f7ea07e5b19e32eR428))
This commit is contained in:
Taylor Mullen 2025-05-06 22:11:29 -07:00 committed by N. Taylor Mullen
parent 201eb38479
commit 782686bcf3
1 changed files with 24 additions and 2 deletions

View File

@ -424,8 +424,30 @@ export const useGeminiStream = (
updateFunctionResponseUI(responseInfo, ToolCallStatus.Error);
setStreamingState(StreamingState.Idle);
} else {
// If accepted, set state back to Responding to wait for server execution/response
setStreamingState(StreamingState.Responding);
const tool = toolRegistry.getTool(request.name);
if (!tool) {
throw new Error(
`Tool "${request.name}" not found or is not registered.`,
);
}
const result = await tool.execute(request.args);
const functionResponse: Part = {
functionResponse: {
name: request.name,
id: request.callId,
response: { output: result.llmContent },
},
};
const responseInfo: ToolCallResponseInfo = {
callId: request.callId,
responsePart: functionResponse,
resultDisplay: result.returnDisplay,
error: undefined,
};
updateFunctionResponseUI(responseInfo, ToolCallStatus.Success);
setStreamingState(StreamingState.Idle);
await submitQuery(functionResponse);
}
};