mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-10 17:18:19 +00:00
fix unit test
This commit is contained in:
@@ -370,26 +370,26 @@ Only use a single line of '=======' between search and replacement content, beca
|
||||
}
|
||||
}
|
||||
|
||||
getProgressStatus(toolUse: ToolUse, result?: DiffResult): ToolProgressStatus {
|
||||
const diffContent = toolUse.params.diff
|
||||
if (diffContent) {
|
||||
const icon = "diff-multiple"
|
||||
const searchBlockCount = (diffContent.match(/SEARCH/g) || []).length
|
||||
if (toolUse.partial) {
|
||||
if (diffContent.length < 1000 || (diffContent.length / 50) % 10 === 0) {
|
||||
return { icon, text: `${searchBlockCount}` }
|
||||
}
|
||||
} else if (result) {
|
||||
if (result.failParts?.length) {
|
||||
return {
|
||||
icon,
|
||||
text: `${searchBlockCount - result.failParts.length}/${searchBlockCount}`,
|
||||
}
|
||||
} else {
|
||||
return { icon, text: `${searchBlockCount}` }
|
||||
}
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
// getProgressStatus(toolUse: ToolUse, result?: DiffResult): ToolProgressStatus {
|
||||
// const diffContent = toolUse.params.diff
|
||||
// if (diffContent) {
|
||||
// const icon = "diff-multiple"
|
||||
// const searchBlockCount = (diffContent.match(/SEARCH/g) || []).length
|
||||
// if (toolUse.partial) {
|
||||
// if (diffContent.length < 1000 || (diffContent.length / 50) % 10 === 0) {
|
||||
// return { icon, text: `${searchBlockCount}` }
|
||||
// }
|
||||
// } else if (result) {
|
||||
// if (result.failParts?.length) {
|
||||
// return {
|
||||
// icon,
|
||||
// text: `${searchBlockCount - result.failParts.length}/${searchBlockCount}`,
|
||||
// }
|
||||
// } else {
|
||||
// return { icon, text: `${searchBlockCount}` }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return {}
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import { applyPatch } from "diff"
|
||||
import { DiffStrategy, DiffResult } from "../types"
|
||||
import { applyPatch } from "diff";
|
||||
|
||||
import { DiffResult, DiffStrategy } from "../types";
|
||||
|
||||
export class UnifiedDiffStrategy implements DiffStrategy {
|
||||
|
||||
getName(): string {
|
||||
return "Unified"
|
||||
}
|
||||
|
||||
getToolDescription(args: { cwd: string; toolOptions?: { [key: string]: string } }): string {
|
||||
return `## apply_diff
|
||||
Description: Apply a unified diff to a file at the specified path. This tool is useful when you need to make specific modifications to a file based on a set of changes provided in unified diff format (diff -U3).
|
||||
|
||||
Reference in New Issue
Block a user