revert: lower the confidence levels

This commit is contained in:
Daniel Riccio
2025-01-08 17:18:09 -05:00
parent 9591ae062a
commit 44dc489e49
2 changed files with 3 additions and 3 deletions

View File

@@ -344,7 +344,7 @@ export async function applyEdit(hunk: Hunk, content: string[], matchPosition: nu
// Normal mode - try strategies sequentially until one succeeds // Normal mode - try strategies sequentially until one succeeds
for (const strategy of strategies) { for (const strategy of strategies) {
const result = await strategy.apply(); const result = await strategy.apply();
if (result.confidence === 1) { if (result.confidence > MIN_CONFIDENCE) {
return result; return result;
} }
} }

View File

@@ -160,7 +160,7 @@ Your diff here
startLine?: number, startLine?: number,
endLine?: number endLine?: number
): Promise<DiffResult> { ): Promise<DiffResult> {
const MIN_CONFIDENCE = 1 const MIN_CONFIDENCE = 0.9
const parsedDiff = this.parseUnifiedDiff(diffContent) const parsedDiff = this.parseUnifiedDiff(diffContent)
const originalLines = originalContent.split("\n") const originalLines = originalContent.split("\n")
let result = [...originalLines] let result = [...originalLines]
@@ -170,7 +170,7 @@ Your diff here
const { index: matchPosition, confidence } = findBestMatch(contextStr, result) const { index: matchPosition, confidence } = findBestMatch(contextStr, result)
const editResult = await applyEdit(hunk, result, matchPosition, confidence) const editResult = await applyEdit(hunk, result, matchPosition, confidence)
if (editResult.confidence >= MIN_CONFIDENCE) { if (editResult.confidence > MIN_CONFIDENCE) {
result = editResult.result result = editResult.result
} else { } else {
return { success: false, error: `Failed to apply edit using ${editResult.strategy} strategy` } return { success: false, error: `Failed to apply edit using ${editResult.strategy} strategy` }