mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix: respect PORT env in internal model-test fetch (#1014)
Internal model test routes fetched 127.0.0.1:UPDATER_CONFIG.appPort (hardcoded 20128). When PORT env is set to a different value, the app listens on PORT but the internal fetch still targets 20128, causing "fetch failed" on /api/models/test and /api/providers/[id]/test-models. Fall back to UPDATER_CONFIG.appPort only when process.env.PORT is unset.
This commit is contained in:
@@ -8,7 +8,7 @@ export async function POST(request) {
|
||||
const { model, kind } = await request.json();
|
||||
if (!model) return NextResponse.json({ error: "Model required" }, { status: 400 });
|
||||
|
||||
const baseUrl = `http://127.0.0.1:${UPDATER_CONFIG.appPort}`;
|
||||
const baseUrl = `http://127.0.0.1:${process.env.PORT || UPDATER_CONFIG.appPort}`;
|
||||
|
||||
// Get an active internal API key for auth (if requireApiKey is enabled)
|
||||
let apiKey = null;
|
||||
|
||||
Reference in New Issue
Block a user