Skip to content

Commit e1fa554

Browse files
refactor: convert retryDiffBlocksPrompt to use object parameter
🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent c996ca7 commit e1fa554

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

backend/src/generate-diffs-prompt.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,24 @@ export const tryToDoStringReplacementWithExtraIndentation = (params: {
130130
return null
131131
}
132132

133-
export async function retryDiffBlocksPrompt(
134-
filePath: string,
135-
oldContent: string,
136-
clientSessionId: string,
137-
fingerprintId: string,
138-
userInputId: string,
139-
userId: string | undefined,
140-
diffBlocksThatDidntMatch: { searchContent: string; replaceContent: string }[],
141-
) {
133+
export async function retryDiffBlocksPrompt(params: {
134+
filePath: string
135+
oldContent: string
136+
clientSessionId: string
137+
fingerprintId: string
138+
userInputId: string
139+
userId: string | undefined
140+
diffBlocksThatDidntMatch: { searchContent: string; replaceContent: string }[]
141+
}) {
142+
const {
143+
filePath,
144+
oldContent,
145+
clientSessionId,
146+
fingerprintId,
147+
userInputId,
148+
userId,
149+
diffBlocksThatDidntMatch,
150+
} = params
142151
const newPrompt =
143152
`The assistant failed to find a match for the following changes. Please help the assistant understand what the changes should be.
144153

backend/src/process-file-block.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,15 @@ Please output just the SEARCH/REPLACE blocks like this:
311311
)
312312

313313
const { newDiffBlocks, newDiffBlocksThatDidntMatch } =
314-
await retryDiffBlocksPrompt(
314+
await retryDiffBlocksPrompt({
315315
filePath,
316-
updatedContent,
316+
oldContent: updatedContent,
317317
clientSessionId,
318318
fingerprintId,
319319
userInputId,
320320
userId,
321321
diffBlocksThatDidntMatch,
322-
)
322+
})
323323

324324
if (newDiffBlocksThatDidntMatch.length > 0) {
325325
logger.error(

0 commit comments

Comments
 (0)