const BACKEND_BASE = process.env.NEXT_PUBLIC_BACKEND_URL; export async function GET( _req: Request, context: { params: Promise<{ request_id: string }> } ) { if (!BACKEND_BASE) { return new Response('NEXT_PUBLIC_BACKEND_URL 未配置', { status: 500 }); } const { request_id } = await context.params; const target = `${BACKEND_BASE}/tasks/${encodeURIComponent(request_id)}`; const resp = await fetch(target, { headers: { 'Content-Type': 'application/json' } }); const headers = new Headers(); const contentType = resp.headers.get('content-type') || 'application/json; charset=utf-8'; headers.set('content-type', contentType); const cacheControl = resp.headers.get('cache-control'); if (cacheControl) headers.set('cache-control', cacheControl); const xAccelBuffering = resp.headers.get('x-accel-buffering'); if (xAccelBuffering) headers.set('x-accel-buffering', xAccelBuffering); return new Response(resp.body, { status: resp.status, headers }); }