mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
refactor: remove debug functionality
This commit is contained in:
@@ -254,11 +254,10 @@ export async function applyEdit(
|
||||
content: string[],
|
||||
matchPosition: number,
|
||||
confidence: number,
|
||||
debug: string = '',
|
||||
minConfidence: number = 0.9
|
||||
): Promise<EditResult> {
|
||||
// Don't attempt regular edits if confidence is too low
|
||||
if (confidence < minConfidence && debug === '') {
|
||||
if (confidence < minConfidence) {
|
||||
console.log(`Search confidence (${confidence}) below minimum threshold (${minConfidence}), trying git fallback...`);
|
||||
return applyGitFallback(hunk, content);
|
||||
}
|
||||
@@ -270,30 +269,10 @@ export async function applyEdit(
|
||||
{ name: 'git-fallback', apply: () => applyGitFallback(hunk, content) }
|
||||
];
|
||||
|
||||
if (debug !== '') {
|
||||
// In debug mode, try all strategies including git fallback
|
||||
const results = await Promise.all([
|
||||
...strategies.map(async strategy => {
|
||||
console.log(`Attempting edit with ${strategy.name} strategy...`);
|
||||
const result = await strategy.apply();
|
||||
console.log(`Strategy ${strategy.name} succeeded with confidence ${result.confidence}`);
|
||||
return result;
|
||||
})
|
||||
]);
|
||||
|
||||
return results.find(result => result.strategy === debug) || { confidence: 0, result: content, strategy: 'none' };
|
||||
} else {
|
||||
// Normal mode - try strategies sequentially until one succeeds
|
||||
// Try strategies sequentially until one succeeds
|
||||
for (const strategy of strategies) {
|
||||
const result = await strategy.apply();
|
||||
if (result.confidence === 1) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// If all strategies fail, try git fallback
|
||||
|
||||
const result = await applyGitFallback(hunk, content);
|
||||
if(result.confidence === 1) {
|
||||
if (result.confidence >= minConfidence) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ Your diff here
|
||||
const contextStr = prepareSearchString(hunk.changes)
|
||||
const { index: matchPosition, confidence, strategy } = findBestMatch(contextStr, result, 0, this.confidenceThreshold)
|
||||
|
||||
const editResult = await applyEdit(hunk, result, matchPosition, confidence, '', this.confidenceThreshold)
|
||||
const editResult = await applyEdit(hunk, result, matchPosition, confidence, this.confidenceThreshold)
|
||||
if (editResult.confidence >= this.confidenceThreshold) {
|
||||
result = editResult.result
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user