mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix edit retrigger (#2306)
This commit is contained in:
@@ -45,6 +45,11 @@ export interface WriteFileToolParams {
|
||||
* The content to write to the file
|
||||
*/
|
||||
content: string;
|
||||
|
||||
/**
|
||||
* Whether the proposed content was modified by the user.
|
||||
*/
|
||||
modified_by_user?: boolean;
|
||||
}
|
||||
|
||||
interface GetCorrectedFileContentResult {
|
||||
@@ -68,7 +73,9 @@ export class WriteFileTool
|
||||
super(
|
||||
WriteFileTool.Name,
|
||||
'WriteFile',
|
||||
'Writes content to a specified file in the local filesystem.',
|
||||
`Writes content to a specified file in the local filesystem.
|
||||
|
||||
The user has the ability to modify \`content\`. If modified, this will be stated in the response.`,
|
||||
{
|
||||
properties: {
|
||||
file_path: {
|
||||
@@ -270,9 +277,16 @@ export class WriteFileTool
|
||||
DEFAULT_DIFF_OPTIONS,
|
||||
);
|
||||
|
||||
const llmSuccessMessage = isNewFile
|
||||
? `Successfully created and wrote to new file: ${params.file_path}`
|
||||
: `Successfully overwrote file: ${params.file_path}`;
|
||||
const llmSuccessMessageParts = [
|
||||
isNewFile
|
||||
? `Successfully created and wrote to new file: ${params.file_path}.`
|
||||
: `Successfully overwrote file: ${params.file_path}.`,
|
||||
];
|
||||
if (params.modified_by_user) {
|
||||
llmSuccessMessageParts.push(
|
||||
`User modified the \`content\` to be: ${params.content}`,
|
||||
);
|
||||
}
|
||||
|
||||
const displayResult: FileDiff = { fileDiff, fileName };
|
||||
|
||||
@@ -298,7 +312,7 @@ export class WriteFileTool
|
||||
}
|
||||
|
||||
return {
|
||||
llmContent: llmSuccessMessage,
|
||||
llmContent: llmSuccessMessageParts.join(' '),
|
||||
returnDisplay: displayResult,
|
||||
};
|
||||
} catch (error) {
|
||||
@@ -395,6 +409,7 @@ export class WriteFileTool
|
||||
) => ({
|
||||
...originalParams,
|
||||
content: modifiedProposedContent,
|
||||
modified_by_user: true,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user