File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed
common/src/tools/params/tool Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 11import { withTimeout } from '@codebuff/common/util/promise'
2+ import { env } from '@codebuff/internal/env'
23
34import { logger } from '../util/logger'
45
@@ -55,7 +56,14 @@ export async function searchLibraries(
5556 url . searchParams . set ( 'query' , query )
5657
5758 const fetchStartTime = Date . now ( )
58- const response = await withTimeout ( fetch ( url ) , FETCH_TIMEOUT_MS )
59+ const response = await withTimeout (
60+ fetch ( url , {
61+ headers : {
62+ Authorization : `Bearer ${ env . CONTEXT7_API_KEY } ` ,
63+ } ,
64+ } ) ,
65+ FETCH_TIMEOUT_MS ,
66+ )
5967 const fetchDuration = Date . now ( ) - fetchStartTime
6068
6169 if ( ! response . ok ) {
@@ -181,6 +189,7 @@ export async function fetchContext7LibraryDocumentation(
181189 const response = await withTimeout (
182190 fetch ( url , {
183191 headers : {
192+ Authorization : `Bearer ${ env . CONTEXT7_API_KEY } ` ,
184193 'X-Context7-Source' : 'codebuff' ,
185194 } ,
186195 } ) ,
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export const readDocsParams = {
2222 ) ,
2323 max_tokens : z
2424 . number ( )
25- . default ( 20_000 )
25+ . default ( 10_000 )
2626 . optional ( )
2727 . describe (
2828 `Optional maximum number of tokens to return. Defaults to 20000. Values less than 10000 are automatically increased to 10000.` ,
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const envSchema = {
1313 OPEN_ROUTER_API_KEY : z . string ( ) . min ( 1 ) ,
1414 RELACE_API_KEY : z . string ( ) . min ( 1 ) ,
1515 LINKUP_API_KEY : z . string ( ) . min ( 1 ) ,
16+ CONTEXT7_API_KEY : z . string ( ) . optional ( ) ,
1617 GOOGLE_CLOUD_PROJECT_ID : z . string ( ) . min ( 1 ) ,
1718 PORT : z . coerce . number ( ) . min ( 1000 ) ,
1819
@@ -54,6 +55,7 @@ const envSchema = {
5455 OPEN_ROUTER_API_KEY : process . env . OPEN_ROUTER_API_KEY ,
5556 RELACE_API_KEY : process . env . RELACE_API_KEY ,
5657 LINKUP_API_KEY : process . env . LINKUP_API_KEY ,
58+ CONTEXT7_API_KEY : process . env . CONTEXT7_API_KEY ,
5759 GOOGLE_CLOUD_PROJECT_ID : process . env . GOOGLE_CLOUD_PROJECT_ID ,
5860 PORT : process . env . PORT ,
5961
You can’t perform that action at this time.
0 commit comments