File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
packages/agent-runtime/src Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 11import { withTimeout } from '@codebuff/common/util/promise'
22import { env } from '@codebuff/common/env'
3-
43import type { Logger } from '@codebuff/common/types/contracts/logger'
54
65const FETCH_TIMEOUT_MS = 30_000
@@ -68,7 +67,8 @@ export async function callWebSearchAPI(params: {
6867 if ( data && typeof data . result === 'string' ) {
6968 return {
7069 result : data . result ,
71- creditsUsed : typeof data . creditsUsed === 'number' ? data . creditsUsed : undefined ,
70+ creditsUsed :
71+ typeof data . creditsUsed === 'number' ? data . creditsUsed : undefined ,
7272 }
7373 }
7474 if ( data && typeof data . error === 'string' ) return { error : data . error }
@@ -154,7 +154,8 @@ export async function callDocsSearchAPI(params: {
154154 if ( data && typeof data . documentation === 'string' ) {
155155 return {
156156 documentation : data . documentation ,
157- creditsUsed : typeof data . creditsUsed === 'number' ? data . creditsUsed : undefined ,
157+ creditsUsed :
158+ typeof data . creditsUsed === 'number' ? data . creditsUsed : undefined ,
158159 }
159160 }
160161 if ( data && typeof data . error === 'string' ) return { error : data . error }
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ export type CodebuffToolHandlerFunction<T extends ToolName = ToolName> = (
3030 repoUrl : string | undefined
3131 repoId : string | undefined
3232 fileContext : ProjectFileContext
33+ apiKey : string
3334
3435 signal : AbortSignal
3536
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export const handleWebSearch = ((params: {
1212 previousToolCallFinished : Promise < void >
1313 toolCall : CodebuffToolCall < 'web_search' >
1414 logger : Logger
15+ apiKey : string
1516
1617 agentStepId : string
1718 clientSessionId : string
@@ -36,6 +37,7 @@ export const handleWebSearch = ((params: {
3637 repoUrl,
3738 state,
3839 fetch,
40+ apiKey
3941 } = params
4042 const { query, depth } = toolCall . input
4143 const { userId, fingerprintId, repoId } = state
@@ -63,6 +65,7 @@ export const handleWebSearch = ((params: {
6365 repoUrl : repoUrl ?? null ,
6466 fetch,
6567 logger,
68+ apiKey
6669 } )
6770
6871 if ( webApi . error ) {
You can’t perform that action at this time.
0 commit comments