const BACKEND_BASE = process.env.BACKEND_INTERNAL_URL || process.env.NEXT_PUBLIC_BACKEND_URL; export async function GET( _req: Request, context: any ) { if (!BACKEND_BASE) { return new Response('BACKEND_INTERNAL_URL/NEXT_PUBLIC_BACKEND_URL 未配置', { status: 500 }); } const raw = context?.params; const params = raw && typeof raw.then === 'function' ? await raw : raw; const provider_id = params?.provider_id as string | undefined; if (!provider_id) { return new Response('provider_id 缺失', { status: 400 }); } const target = `${BACKEND_BASE}/discover-models/${encodeURIComponent(provider_id)}`; const resp = await fetch(target, { headers: { 'Content-Type': 'application/json' }, cache: 'no-store', }); const text = await resp.text(); return new Response(text, { status: resp.status, headers: { 'Content-Type': resp.headers.get('Content-Type') || 'application/json' }, }); }