summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useGeminiStream.ts
diff options
context:
space:
mode:
authorTaylor Mullen <[email protected]>2025-05-06 22:11:29 -0700
committerN. Taylor Mullen <[email protected]>2025-05-06 22:12:27 -0700
commit782686bcf33052309db530ef5fe61c35622f7ba5 (patch)
tree1057f7864d5ace056e1ee0d9a6ba4abe97df7355 /packages/cli/src/ui/hooks/useGeminiStream.ts
parent201eb38479f4acfcb83c25dd20f0957fea25e7c3 (diff)
Fix edit confirmation re-submission.
- This broke in [this commit](https://github.com/google-gemini/gemini-code/commit/7d13f242887f4204a2c8a0ca719e121621472db9#diff-e257a7e5e02896371ce002da8963abdb91f5c77990d38e3d2f7ea07e5b19e32eR428)
Diffstat (limited to 'packages/cli/src/ui/hooks/useGeminiStream.ts')
-rw-r--r--packages/cli/src/ui/hooks/useGeminiStream.ts26
1 files changed, 24 insertions, 2 deletions
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts
index b7ed771e..611ea3e7 100644
--- a/packages/cli/src/ui/hooks/useGeminiStream.ts
+++ b/packages/cli/src/ui/hooks/useGeminiStream.ts
@@ -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);
}
};