Skip to content

Commit c00adcd

Browse files
committed
refactor: convert getSearchSystemPrompt to use object parameter
1 parent cd656b7 commit c00adcd

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

backend/src/system-prompt/search-system-prompt.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@ import { countTokens, countTokensJson } from '../util/token-counter'
1111

1212
import type { ProjectFileContext } from '@codebuff/common/util/file'
1313

14-
export function getSearchSystemPrompt(
15-
fileContext: ProjectFileContext,
16-
messagesTokens: number,
14+
export function getSearchSystemPrompt(params: {
15+
fileContext: ProjectFileContext
16+
messagesTokens: number
1717
options: {
1818
agentStepId: string
1919
clientSessionId: string
2020
fingerprintId: string
2121
userInputId: string
2222
userId: string | undefined
23-
},
24-
): string {
23+
}
24+
}): string {
25+
const { fileContext, messagesTokens, options } = params
2526
const startTime = Date.now()
2627

2728
const maxTokens = 500_000 // costMode === 'lite' ? 64_000 :

backend/src/tools/handlers/tool/find-files.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,16 @@ export const handleFindFiles = ((params: {
6868
}
6969

7070
const fileRequestMessagesTokens = countTokensJson(messages)
71-
const system = getSearchSystemPrompt(fileContext, fileRequestMessagesTokens, {
72-
agentStepId,
73-
clientSessionId,
74-
fingerprintId,
75-
userInputId,
76-
userId,
71+
const system = getSearchSystemPrompt({
72+
fileContext,
73+
messagesTokens: fileRequestMessagesTokens,
74+
options: {
75+
agentStepId,
76+
clientSessionId,
77+
fingerprintId,
78+
userInputId,
79+
userId,
80+
},
7781
})
7882

7983
const triggerFindFiles: () => Promise<

0 commit comments

Comments
 (0)