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:
Anh
2026-05-11 15:57:02 +07:00
committed by GitHub
parent 50b8a59f99
commit 06291b290f
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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;