fix "calling" state

This commit is contained in:
Nate 2024-11-29 11:44:31 -08:00
parent d3d9af4292
commit 1beeb586d7
2 changed files with 12 additions and 4 deletions

View file

@ -1,5 +1,10 @@
import { CheckIcon, XMarkIcon } from "@heroicons/react/24/outline";
import {
ArrowRightIcon,
CheckIcon,
XMarkIcon,
} from "@heroicons/react/24/outline";
import { ToolCall, ToolCallState, ToolStatus } from "core";
import { vscButtonBackground } from "../../../components";
import Spinner from "../../../components/markdown/StepContainerPreToolbar/Spinner";
import FunctionSpecificToolCallDiv from "./FunctionSpecificToolCallDiv";
import { ThreadDiv } from "./ThreadDiv";
@ -14,8 +19,9 @@ export function ToolCallDiv(props: ToolCallDivProps) {
switch (state) {
case "generating":
case "calling":
case "generated":
return <Spinner />;
case "generated":
return <ArrowRightIcon color={vscButtonBackground} />;
case "done":
return <CheckIcon className="text-green-500" />;
case "canceled":

View file

@ -1,6 +1,6 @@
import { createAsyncThunk } from "@reduxjs/toolkit";
import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall";
import { setToolCallOutput } from "../slices/stateSlice";
import { setCalling, setToolCallOutput } from "../slices/stateSlice";
import { ThunkApiType } from "../store";
import { streamResponseAfterToolCall } from "./streamResponseAfterToolCall";
@ -19,6 +19,8 @@ export const callTool = createAsyncThunk<void, undefined, ThunkApiType>(
return;
}
dispatch(setCalling());
const result = await extra.ideMessenger.request("tools/call", {
toolCall: toolCallState.toolCall,
});
@ -26,7 +28,7 @@ export const callTool = createAsyncThunk<void, undefined, ThunkApiType>(
if (result.status === "success") {
const contextItems = result.content.contextItems;
dispatch(setToolCallOutput(contextItems));
// Send to the LLM to continue the conversation
dispatch(
streamResponseAfterToolCall({