W n8n attention vm

This commit is contained in:
alma 2025-05-24 18:18:48 +02:00
parent 503afb99f9
commit c0bbcba507

View File

@ -246,6 +246,15 @@ export async function POST(request: Request) {
const firstResult = workflowResult.results[0];
console.log('First result from workflow:', JSON.stringify(firstResult, null, 2));
// Check if the result is HTML (error case)
if (typeof firstResult === 'string' && firstResult.includes('<!DOCTYPE html>')) {
console.error('Received HTML response instead of JSON:', firstResult);
return NextResponse.json({
error: 'Invalid response from workflow',
details: 'Received HTML instead of JSON data'
}, { status: 500 });
}
if (firstResult && firstResult.json && firstResult.json.logoPath) {
logoPath = firstResult.json.logoPath;
console.log('Extracted logo path:', logoPath);