Files
odysseus/static/js/generatedImageResult.js
T
pewdiepie-archdaemon 2e8413a54a Preserve preview harness, editor, email and task improvements
Snapshot current maintainer-preview application changes and regression fixtures for integration into lab. Excludes local runtime data, evaluation outputs and source backups. Focused Python regression selection: 140 passed; full suite not certified.
2026-10-01 01:34:26 +00:00

14 lines
568 B
JavaScript

// Older saved turns kept image fields only inside the tool's JSON output.
export function generatedImageResult(event) {
if (!event || event.error || (event.exit_code != null && event.exit_code !== 0)) return null;
if (event.image_url) return event;
if (!['generate_image', 'edit_image'].includes(event.tool) || typeof event.output !== 'string') return null;
try {
const result = JSON.parse(event.output);
if (result.error || !result.image_url || typeof result.image_url !== 'string') return null;
return result;
} catch {
return null;
}
}