fix: avoid flatMap crash when output.images is undefined

This commit is contained in:
TiamaTiramisu
2025-04-21 11:42:42 +09:00
parent 22a50904f8
commit 0f70c5404a

View File

@@ -435,7 +435,7 @@ export async function generateAIImage(genPrompt:string, currentChar:character, n
} }
await new Promise(r => setTimeout(r, 1000)) await new Promise(r => setTimeout(r, 1000))
} // Check history until the generation is complete. } // Check history until the generation is complete.
const genImgInfo = Object.values(item.outputs).flatMap((output: any) => output.images)[0]; const genImgInfo = Object.values(item.outputs).flatMap((output: any) => output.images || [])[0];
const imgResponse = await fetchNative(createUrl('/view', { const imgResponse = await fetchNative(createUrl('/view', {
filename: genImgInfo.filename, filename: genImgInfo.filename,