Changesets · Branches · Tags · Compare
| Changeset | e8f6b7fe8bda226cbddd10e75422adbcf87b64302f0b3c3cb77cd1ed94a378ec |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-07-01 01:57 -07:00 |
| Committer | Dallin Romney <dallinromney@gmail.com> · 2025-07-01 01:57 -07:00 |
| Parents | ab40c6302033 |
6 files changed
modified gui/src/components/AcceptRejectDiffButtons.tsx +14 −1
| @@ -2,6 +2,9 @@ | ||
| 2 | 2 | import { ApplyState } from "core"; |
| 3 | 3 | import { useContext } from "react"; |
| 4 | 4 | import { IdeMessengerContext } from "../context/IdeMessenger"; |
| 5 | +import { useAppDispatch, useAppSelector } from "../redux/hooks"; | |
| 6 | +import { selectCurrentToolCallApplyState } from "../redux/selectors/selectCurrentToolCall"; | |
| 7 | +import { cancelToolCall } from "../redux/slices/sessionSlice"; | |
| 5 | 8 | import { getMetaKeyLabel } from "../util"; |
| 6 | 9 | import { ToolTip } from "./gui/Tooltip"; |
| 7 | 10 | |
| @@ -20,8 +23,18 @@ | ||
| 20 | 23 | (state) => state.status === "done", |
| 21 | 24 | ); |
| 22 | 25 | const ideMessenger = useContext(IdeMessengerContext); |
| 23 | - | |
| 26 | + const currentToolCallApplyState = useAppSelector( | |
| 27 | + selectCurrentToolCallApplyState, | |
| 28 | + ); | |
| 29 | + const dispatch = useAppDispatch(); | |
| 24 | 30 | async function handleAcceptOrReject(status: AcceptOrRejectOutcome) { |
| 31 | + if (currentToolCallApplyState?.status === "done") { | |
| 32 | + dispatch( | |
| 33 | + cancelToolCall({ | |
| 34 | + toolCallId: currentToolCallApplyState.toolCallId!, | |
| 35 | + }), | |
| 36 | + ); | |
| 37 | + } | |
| 25 | 38 | for (const { filepath = "", streamId } of pendingApplyStates) { |
| 26 | 39 | ideMessenger.post(status, { |
| 27 | 40 | filepath, |
modified gui/src/components/mainInput/InputToolbar.tsx +1 −13
| @@ -9,10 +9,6 @@ | ||
| 9 | 9 | import { IdeMessengerContext } from "../../context/IdeMessenger"; |
| 10 | 10 | import { useAppDispatch, useAppSelector } from "../../redux/hooks"; |
| 11 | 11 | import { selectUseActiveFile } from "../../redux/selectors"; |
| 12 | -import { | |
| 13 | - selectCurrentToolCall, | |
| 14 | - selectCurrentToolCallApplyState, | |
| 15 | -} from "../../redux/selectors/selectCurrentToolCall"; | |
| 16 | 12 | import { selectSelectedChatModel } from "../../redux/slices/configSlice"; |
| 17 | 13 | import { setHasReasoningEnabled } from "../../redux/slices/sessionSlice"; |
| 18 | 14 | import { exitEdit } from "../../redux/thunks/edit"; |
| @@ -53,20 +49,12 @@ | ||
| 53 | 49 | const useActiveFile = useAppSelector(selectUseActiveFile); |
| 54 | 50 | const isInEdit = useAppSelector((store) => store.session.isInEdit); |
| 55 | 51 | const codeToEdit = useAppSelector((store) => store.editModeState.codeToEdit); |
| 56 | - const toolCallState = useAppSelector(selectCurrentToolCall); | |
| 57 | - const currentToolCallApplyState = useAppSelector( | |
| 58 | - selectCurrentToolCallApplyState, | |
| 59 | - ); | |
| 60 | 52 | const hasReasoningEnabled = useAppSelector( |
| 61 | 53 | (store) => store.session.hasReasoningEnabled, |
| 62 | 54 | ); |
| 63 | 55 | |
| 64 | 56 | const isEnterDisabled = |
| 65 | - props.disabled || | |
| 66 | - (isInEdit && codeToEdit.length === 0) || | |
| 67 | - toolCallState?.status === "generated" || | |
| 68 | - (currentToolCallApplyState && | |
| 69 | - currentToolCallApplyState.status !== "closed"); | |
| 57 | + props.disabled || (isInEdit && codeToEdit.length === 0); | |
| 70 | 58 | |
| 71 | 59 | const toolsSupported = defaultModel && modelSupportsTools(defaultModel); |
| 72 | 60 |
modified gui/src/hooks/ParallelListeners.tsx +5 −6
| @@ -268,7 +268,6 @@ | ||
| 268 | 268 | currentToolCallApplyState.streamId === state.streamId |
| 269 | 269 | ) { |
| 270 | 270 | if (state.status === "done" && autoAcceptEditToolDiffs) { |
| 271 | - console.log("AUTO ACCEPTED"); | |
| 272 | 271 | ideMessenger.post("acceptDiff", { |
| 273 | 272 | streamId: state.streamId, |
| 274 | 273 | filepath: state.filepath, |
| @@ -281,6 +280,11 @@ | ||
| 281 | 280 | toolCallId: currentToolCallApplyState.toolCallId!, |
| 282 | 281 | }), |
| 283 | 282 | ); |
| 283 | + void dispatch( | |
| 284 | + streamResponseAfterToolCall({ | |
| 285 | + toolCallId: currentToolCallApplyState.toolCallId!, | |
| 286 | + }), | |
| 287 | + ); | |
| 284 | 288 | } |
| 285 | 289 | // const output: ContextItem = { |
| 286 | 290 | // name: "Edit tool output", |
| @@ -288,11 +292,6 @@ | ||
| 288 | 292 | // description: "", |
| 289 | 293 | // }; |
| 290 | 294 | // dispatch(setToolCallOutput([])); |
| 291 | - void dispatch( | |
| 292 | - streamResponseAfterToolCall({ | |
| 293 | - toolCallId: currentToolCallApplyState.toolCallId!, | |
| 294 | - }), | |
| 295 | - ); | |
| 296 | 295 | } |
| 297 | 296 | } |
| 298 | 297 | } |
modified gui/src/pages/gui/Chat.tsx +1 −1
| @@ -319,7 +319,7 @@ | ||
| 319 | 319 | inputId={item.message.id} |
| 320 | 320 | /> |
| 321 | 321 | </> |
| 322 | - ) : item.message.role === "tool" ? null : item.message.role === | |
| 322 | + ) : item.message.role === "tool" ? null : item.message.role === // /> // toolCallId={item.message.toolCallId} // contextItems={item.contextItems} // <ToolOutput | |
| 323 | 323 | "assistant" && |
| 324 | 324 | item.message.toolCalls && |
| 325 | 325 | item.toolCallState ? ( |
modified gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +1 −1
| @@ -73,7 +73,7 @@ | ||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return ( |
| 76 | - <div className="flex flex-col pl-5 pr-2 pt-4"> | |
| 76 | + <div className="flex flex-col py-4 pl-5 pr-2"> | |
| 77 | 77 | <div className="flex min-w-0 flex-row items-center justify-between gap-2"> |
| 78 | 78 | <div |
| 79 | 79 | className={`text-description flex min-w-0 flex-row items-center justify-between gap-1.5 text-xs transition-colors duration-200 ease-in-out ${ |
modified gui/src/redux/util/constructMessages.ts +3 −1
| @@ -114,7 +114,9 @@ | ||
| 114 | 114 | for (const toolCall of item.message.toolCalls) { |
| 115 | 115 | let content: string = "No tool output"; |
| 116 | 116 | // TODO toolCallState only supports one tool call per message for now |
| 117 | - if ( | |
| 117 | + if (item.toolCallState?.status === "canceled") { | |
| 118 | + content = "The user cancelled this tool call."; | |
| 119 | + } else if ( | |
| 118 | 120 | item.toolCallState?.toolCallId === toolCall.id && |
| 119 | 121 | item.toolCallState?.output |
| 120 | 122 | ) { |