chore(workbench): logga orsaken till strukturfel #438

Merged
admin merged 1 commits from fix/structure-error-visibility into main 2026-11-02 15:34:27 +00:00
+2
View File
@@ -244,6 +244,7 @@ export async function POST(request: NextRequest) {
);
}
console.log('[0pt-workbench] doc0 source read:', sources.sources.length, 'segments');
const sourceChars = sources.sources.reduce((total, source) => total + source.text.length, 0);
const estimatedInputTokens = Math.ceil(JSON.stringify(sources.sources).length / 4) + 1024;
if (estimatedInputTokens > policy.maxInputTokens) {
@@ -433,6 +434,7 @@ export async function POST(request: NextRequest) {
}
}
const message = error instanceof Error ? error.message : 'Structuring failed';
console.error('[0pt-workbench] structure failed:', message);
return NextResponse.json(
{ error: 'STRUCTURE_FAILED', message, reservation_id: reservationId },
{ status: 502 },