-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
544 additions
and
1,217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
export async function GET(req: Request) { | ||
const res = await fetch(process.env.VLLM_URL + "/v1/models"); | ||
return new Response(res.body, res); | ||
} | ||
import { NextRequest, NextResponse } from "next/server"; | ||
|
||
// forces the route handler to be dynamic | ||
export const dynamic = "force-dynamic"; | ||
export async function GET(req: NextRequest) { | ||
try { | ||
const res = await fetch(process.env.VLLM_URL + "/v1/models"); | ||
if (res.status !== 200) { | ||
const statusText = res.statusText; | ||
const responseBody = await res.text(); | ||
console.error(`vLLM /api/models response error: ${responseBody}`); | ||
return NextResponse.json( | ||
{ | ||
success: false, | ||
error: statusText, | ||
}, | ||
{ status: res.status } | ||
); | ||
} | ||
return new Response(res.body, res); | ||
} catch (error) { | ||
console.error(error); | ||
return NextResponse.json( | ||
{ | ||
success: false, | ||
error: error instanceof Error ? error.message : "Unknown error", | ||
}, | ||
{ status: 500 } | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.