diff --git a/refact-agent/gui/src/components/ChatForm/ToolConfirmation.tsx b/refact-agent/gui/src/components/ChatForm/ToolConfirmation.tsx index 1295ec711..c0b72fd05 100644 --- a/refact-agent/gui/src/components/ChatForm/ToolConfirmation.tsx +++ b/refact-agent/gui/src/components/ChatForm/ToolConfirmation.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useMemo } from "react"; +import React, { useMemo } from "react"; import { PATCH_LIKE_FUNCTIONS, useAppDispatch, @@ -88,10 +88,6 @@ export const ToolConfirmation: React.FC = ({ confirmToolUsage(); }; - const handleReject = useCallback(() => { - rejectToolUsage(toolCallIds); - }, [rejectToolUsage, toolCallIds]); - const message = getConfirmationMessage( commands, rules, @@ -105,7 +101,7 @@ export const ToolConfirmation: React.FC = ({ return ( ); @@ -171,7 +167,7 @@ export const ToolConfirmation: React.FC = ({ color="red" variant="surface" size="1" - onClick={handleReject} + onClick={rejectToolUsage} > Stop diff --git a/refact-agent/gui/src/hooks/useSendChatRequest.ts b/refact-agent/gui/src/hooks/useSendChatRequest.ts index 28ef04031..2a95ed81f 100644 --- a/refact-agent/gui/src/hooks/useSendChatRequest.ts +++ b/refact-agent/gui/src/hooks/useSendChatRequest.ts @@ -50,11 +50,9 @@ import { setChatMode, setIsWaitingForResponse, setLastUserMessageId, - upsertToolCall, } from "../features/Chat"; import { v4 as uuidv4 } from "uuid"; -import { upsertToolCallIntoHistory } from "../features/History/historySlice"; type SubmitHandlerParams = | { @@ -321,27 +319,16 @@ export const useSendChatRequest = () => { dispatch(setIsWaitingForResponse(false)); }, [abort, dispatch]); - const rejectToolUsage = useCallback( - (toolCallIds: string[]) => { - abort(); - - toolCallIds.forEach((toolCallId) => { - dispatch( - upsertToolCallIntoHistory({ toolCallId, chatId, accepted: false }), - ); - dispatch(upsertToolCall({ toolCallId, chatId, accepted: false })); - }); - - dispatch( - clearPauseReasonsAndHandleToolsStatus({ - wasInteracted: true, - confirmationStatus: false, - }), - ); - dispatch(setIsWaitingForResponse(false)); - }, - [abort, chatId, dispatch], - ); + const rejectToolUsage = useCallback(() => { + abort(); + dispatch( + clearPauseReasonsAndHandleToolsStatus({ + wasInteracted: true, + confirmationStatus: false, + }), + ); + dispatch(setIsWaitingForResponse(false)); + }, [abort, dispatch]); const retryFromIndex = useCallback( (index: number, question: UserMessage["content"]) => {