Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ interface ToolCallState {
toolCall: ToolCall;
status: ToolStatus;
parsedArgs: any;
processedArgs?: Record<string, any>; // Added in preprocesing step
output?: ContextItem[];
tool?: Tool;
}
Expand Down
29 changes: 15 additions & 14 deletions gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function FunctionSpecificToolCallDiv({
historyIndex: number;
}) {
const args = toolCallState.parsedArgs;
const processedArgs = toolCallState.processedArgs;
const toolCall = toolCallState.toolCall;

switch (toolCall.function?.name) {
Expand All @@ -28,26 +29,26 @@ function FunctionSpecificToolCallDiv({
case BuiltInToolNames.EditExistingFile:
return (
<EditFile
relativeFilePath={args?.filepath ?? ""}
changes={args?.changes ?? ""}
relativeFilePath={processedArgs?.filepath ?? args?.filepath ?? ""}
changes={processedArgs?.changes ?? args?.changes ?? ""}
toolCallId={toolCall.id}
historyIndex={historyIndex}
/>
);
case BuiltInToolNames.SingleFindAndReplace:
const edits: EditOperation[] = [
{
old_string: args?.old_string ?? "",
new_string: args?.new_string ?? "",
replace_all: args?.replace_all,
old_string: processedArgs?.old_string ?? args?.old_string ?? "",
new_string: processedArgs?.new_string ?? args?.new_string ?? "",
replace_all: processedArgs?.replace_all ?? args?.replace_all,
},
];
return (
<FindAndReplaceDisplay
editingFileContents={args?.editingFileContents}
fileUri={args?.fileUri ?? ""}
newFileContents={args?.newFileContents}
relativeFilePath={args?.filepath ?? ""}
editingFileContents={processedArgs?.editingFileContents}
fileUri={processedArgs?.fileUri ?? ""}
newFileContents={processedArgs?.newFileContents}
relativeFilePath={processedArgs?.filepath ?? args?.filepath ?? ""}
edits={edits}
toolCallId={toolCall.id}
historyIndex={historyIndex}
Expand All @@ -56,11 +57,11 @@ function FunctionSpecificToolCallDiv({
case BuiltInToolNames.MultiEdit:
return (
<FindAndReplaceDisplay
editingFileContents={args?.editingFileContents}
relativeFilePath={args?.filepath ?? ""}
fileUri={args?.fileUri ?? ""}
newFileContents={args?.newFileContents}
edits={args?.edits ?? []}
editingFileContents={processedArgs?.editingFileContents}
relativeFilePath={processedArgs?.filepath ?? args?.filepath ?? ""}
fileUri={processedArgs?.fileUri ?? ""}
newFileContents={processedArgs?.newFileContents}
edits={processedArgs?.edits ?? args?.edits ?? []}
toolCallId={toolCall.id}
historyIndex={historyIndex}
/>
Expand Down
6 changes: 3 additions & 3 deletions gui/src/redux/slices/sessionSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ export const sessionSlice = createSlice({
);
}
},
setToolCallArgs: (
setProcessedToolCallArgs: (
state,
action: PayloadAction<{
toolCallId: string;
Expand All @@ -860,7 +860,7 @@ export const sessionSlice = createSlice({
action.payload.toolCallId,
);
if (toolCallState) {
toolCallState.parsedArgs = action.payload.newArgs;
toolCallState.processedArgs = action.payload.newArgs;
}
},
cancelToolCall: (
Expand Down Expand Up @@ -1038,7 +1038,7 @@ export const {
acceptToolCall,
setToolGenerated,
updateToolCallOutput,
setToolCallArgs,
setProcessedToolCallArgs,
setMode,
setIsSessionMetadataLoading,
setAllSessionMetadata,
Expand Down
52 changes: 0 additions & 52 deletions gui/src/redux/thunks/enhanceParsedArgs.ts

This file was deleted.

4 changes: 2 additions & 2 deletions gui/src/redux/thunks/preprocessToolCallArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import posthog from "posthog-js";
import { IIdeMessenger } from "../../context/IdeMessenger";
import {
errorToolCall,
setToolCallArgs,
setProcessedToolCallArgs,
updateToolCallOutput,
} from "../slices/sessionSlice";
import { AppThunkDispatch } from "../store";
Expand Down Expand Up @@ -61,7 +61,7 @@ export async function preprocessToolCalls(
);
} else if (preprocessedArgs) {
dispatch(
setToolCallArgs({
setProcessedToolCallArgs({
toolCallId: tcState.toolCallId,
newArgs: preprocessedArgs,
}),
Expand Down
1 change: 1 addition & 0 deletions gui/src/util/clientTools/editImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { resolveRelativePathInDir } from "core/util/ideUtils";
import { v4 as uuid } from "uuid";
import { applyForEditTool } from "../../redux/thunks/handleApplyStateUpdate";
import { ClientToolImpl } from "./callClientTool";

export const editToolImpl: ClientToolImpl = async (
args,
toolCallId,
Expand Down
Loading