mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 20:31:37 -05:00
Refactor edit strategies and confidence validation in unified diff processing
- Enhanced the applyContextMatching and applyDMP functions to improve handling of context and edit changes. - Updated confidence validation logic to ensure stricter checks, now requiring a minimum confidence of 1 for successful edits. - Refined the way changes are processed, including better tracking of removal and addition changes. - Improved the validation of edit results by incorporating strategy-specific checks and logging for better debugging. - Adjusted the applyEdit function to ensure strategies are applied in a more robust manner, with clearer handling of debug mode.
This commit is contained in:
@@ -160,7 +160,7 @@ Your diff here
|
||||
startLine?: number,
|
||||
endLine?: number
|
||||
): Promise<DiffResult> {
|
||||
const MIN_CONFIDENCE = 0.9
|
||||
const MIN_CONFIDENCE = 1
|
||||
const parsedDiff = this.parseUnifiedDiff(diffContent)
|
||||
const originalLines = originalContent.split("\n")
|
||||
let result = [...originalLines]
|
||||
@@ -170,7 +170,7 @@ Your diff here
|
||||
const { index: matchPosition, confidence } = findBestMatch(contextStr, result)
|
||||
|
||||
const editResult = await applyEdit(hunk, result, matchPosition, confidence)
|
||||
if (editResult.confidence > MIN_CONFIDENCE) {
|
||||
if (editResult.confidence >= MIN_CONFIDENCE) {
|
||||
result = editResult.result
|
||||
} else {
|
||||
return { success: false, error: `Failed to apply edit using ${editResult.strategy} strategy` }
|
||||
|
||||
Reference in New Issue
Block a user