fix: edit impl
This commit is contained in:
parent
0b7b6c41bb
commit
9cc3d69e4d
2 changed files with 31 additions and 10 deletions
|
|
@ -89,6 +89,33 @@ export const handleApplyStateUpdate = createAsyncThunk<
|
|||
toolCallId: applyState.toolCallId,
|
||||
}),
|
||||
);
|
||||
dispatch(
|
||||
updateToolCallOutput({
|
||||
toolCallId: applyState.toolCallId,
|
||||
contextItems: [
|
||||
{
|
||||
name: "Edit Success",
|
||||
content: `Successfully edited ${applyState.filepath}`,
|
||||
description: "",
|
||||
hidden: true,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
dispatch(
|
||||
updateToolCallOutput({
|
||||
toolCallId: applyState.toolCallId,
|
||||
contextItems: [
|
||||
{
|
||||
name: "Edit Failed",
|
||||
content: `Failed to edited ${applyState.filepath}. To continue working with the file, read it again to see the most up-to-date contents`,
|
||||
description: "",
|
||||
hidden: true,
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
void dispatch(
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ export const editToolImpl: ClientToolImpl = async (
|
|||
filepath = filepath.slice(2);
|
||||
}
|
||||
|
||||
const openFiles = await extras.ideMessenger.ide.getOpenFiles();
|
||||
let firstUriMatch = await resolveRelativePathInDir(
|
||||
filepath,
|
||||
extras.ideMessenger.ide,
|
||||
);
|
||||
|
||||
|
||||
if (!firstUriMatch) {
|
||||
const openFiles = await extras.ideMessenger.ide.getOpenFiles();
|
||||
for (const uri of openFiles) {
|
||||
if (uri.endsWith(filepath)) {
|
||||
firstUriMatch = uri;
|
||||
|
|
@ -46,13 +46,7 @@ export const editToolImpl: ClientToolImpl = async (
|
|||
);
|
||||
|
||||
return {
|
||||
respondImmediately: true,
|
||||
output: [
|
||||
{
|
||||
name: "File edited successfully",
|
||||
content: `Successfully initiated edit for ${firstUriMatch}`,
|
||||
description: "File edit operation started",
|
||||
},
|
||||
],
|
||||
respondImmediately: false,
|
||||
output: undefined, // no immediate output - output for edit tools should be added based on apply state coming in
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue