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:
parent
50b8a59f99
commit
06291b290f
2 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export async function POST(request, { params }) {
|
|||
|
||||
let models = getProviderModels(alias);
|
||||
|
||||
const baseUrl = `http://127.0.0.1:${UPDATER_CONFIG.appPort}`;
|
||||
const baseUrl = `http://127.0.0.1:${process.env.PORT || UPDATER_CONFIG.appPort}`;
|
||||
|
||||
// Compatible providers: fetch live model list
|
||||
if (isCompatible && models.length === 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue