Skip to content

Commit dc4c738

Browse files
committed
inject fetch into linkup-api
1 parent 5bf5771 commit dc4c738

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

backend/src/llm-apis/linkup-api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ export async function searchWeb(options: {
2727
query: string
2828
depth?: 'standard' | 'deep'
2929
logger: Logger
30+
fetch: typeof globalThis.fetch
3031
}): Promise<string | null> {
31-
const { query, depth = 'standard', logger } = options
32+
const { query, depth = 'standard', logger, fetch } = options
3233
const apiStartTime = Date.now()
3334

3435
const requestBody = {

backend/src/tools/handlers/tool/web-search.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const handleWebSearch = ((params: {
2525
fingerprintId?: string
2626
repoId?: string
2727
}
28+
fetch: typeof globalThis.fetch
2829
}): { result: Promise<CodebuffToolOutput<'web_search'>>; state: {} } => {
2930
const {
3031
previousToolCallFinished,
@@ -35,6 +36,7 @@ export const handleWebSearch = ((params: {
3536
userInputId,
3637
repoUrl,
3738
state,
39+
fetch,
3840
} = params
3941
const { query, depth } = toolCall.input
4042
const { userId, fingerprintId, repoId } = state
@@ -60,7 +62,7 @@ export const handleWebSearch = ((params: {
6062
const webSearchPromise: Promise<CodebuffToolOutput<'web_search'>> =
6163
(async () => {
6264
try {
63-
const searchResult = await searchWeb({ query, depth, logger })
65+
const searchResult = await searchWeb({ query, depth, logger, fetch })
6466
const searchDuration = Date.now() - searchStartTime
6567
const resultLength = searchResult?.length || 0
6668
const hasResults = Boolean(searchResult && searchResult.trim())

0 commit comments

Comments
 (0)