Roo-Code/src/core/diff/DiffStrategy.ts
2025-04-03 11:09:02 -04:00

22 lines
778 B
TypeScript

import type { DiffStrategy } from "./types"
import { MultiSearchReplaceDiffStrategy } from "./strategies/multi-search-replace"
import { ExperimentId } from "../../shared/experiments"
export type { DiffStrategy }
/**
* Get the appropriate diff strategy for the given model
* @param model The name of the model being used (e.g., 'gpt-4', 'claude-3-opus')
* @returns The appropriate diff strategy for the model
*/
export type DiffStrategyName = "multi-search-and-replace"
type GetDiffStrategyOptions = {
model: string
experiments: Partial<Record<ExperimentId, boolean>>
fuzzyMatchThreshold?: number
}
export const getDiffStrategy = ({ fuzzyMatchThreshold, experiments }: GetDiffStrategyOptions): DiffStrategy =>
new MultiSearchReplaceDiffStrategy(fuzzyMatchThreshold)