File tree Expand file tree Collapse file tree
app/api/providers/vllm/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,4 +62,13 @@ describe('vLLM models route', () => {
6262 } )
6363 )
6464 } )
65+
66+ it ( 'returns an empty model list when the configured base URL is unsupported' , async ( ) => {
67+ setEnv ( { VLLM_BASE_URL : 'http://localhost:1234?token=value' } )
68+
69+ const response = await GET ( request ( ) )
70+
71+ await expect ( response . json ( ) ) . resolves . toEqual ( { models : [ ] } )
72+ expect ( mockFetch ) . not . toHaveBeenCalled ( )
73+ } )
6574} )
Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ export const GET = withRouteHandler(async (_request: NextRequest) => {
2727 logger . info ( 'VLLM_BASE_URL not configured' )
2828 return NextResponse . json ( { models : [ ] } )
2929 }
30- const apiBaseUrl = getOpenAICompatibleApiBaseUrl ( baseUrl )
3130
3231 try {
32+ const apiBaseUrl = getOpenAICompatibleApiBaseUrl ( baseUrl )
3333 logger . info ( 'Fetching vLLM models' , {
3434 baseUrl,
3535 } )
Original file line number Diff line number Diff line change @@ -59,9 +59,9 @@ export const vllmProvider: ProviderConfig = {
5959 logger . info ( 'VLLM_BASE_URL not configured, skipping initialization' )
6060 return
6161 }
62- const apiBaseUrl = getOpenAICompatibleApiBaseUrl ( baseUrl )
6362
6463 try {
64+ const apiBaseUrl = getOpenAICompatibleApiBaseUrl ( baseUrl )
6565 const headers : Record < string , string > = {
6666 'Content-Type' : 'application/json' ,
6767 }
You can’t perform that action at this time.
0 commit comments