import { NextRequest, NextResponse } from 'next/server'; const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'; /** * GET /api/jobs/[jobId]/crash-report * * Fetches the crash report for a failed or partial job. * Returns detailed crash analysis including pattern identification, * confidence score, suggested fixes, and auto-fix parameters. */ export async function GET( request: NextRequest, { params }: { params: Promise<{ jobId: string }> } ) { try { const { jobId } = await params; const response = await fetch(`${API_BASE_URL}/jobs/${jobId}/crash-report`, { headers: { 'Accept': 'application/json', }, }); const data = await response.json(); if (!response.ok) { return NextResponse.json( { error: data.detail || 'Failed to get crash report' }, { status: response.status } ); } return NextResponse.json(data); } catch (error) { console.error('Crash report API error:', error); return NextResponse.json( { error: 'Failed to get crash report' }, { status: 500 } ); } }