fix(pipeline): route content-aware resize correctly and improve error messages

- Route resize steps with contentAware=true to the content-aware-resize
  tool in both single-file and batch pipeline paths
- Update HEIC filename extension to .png after decoding so downstream
  tools don't attempt double-decoding
- Wrap per-step errors with step number and tool name for clarity
  (e.g. "Step 1 (resize): Resize requires width, height, or percentage")
- Show first file's step-level error in batch failure messages
This commit is contained in:
Siddharth Kumar Sah
2026-04-13 17:04:11 +08:00
parent 940638680e
commit cd886f0f82
2 changed files with 68 additions and 29 deletions
+12 -3
View File
@@ -265,9 +265,18 @@ export function usePipelineProcessor() {
let errorMsg: string;
try {
const body = JSON.parse(text);
errorMsg = body.details
? `${body.error}: ${body.details}`
: body.error || `Batch processing failed: ${response.status}`;
if (body.errors && Array.isArray(body.errors) && body.errors.length > 0) {
// Show the first file's step-level error (all files typically fail at the same step)
const first = body.errors[0];
errorMsg = first.error;
if (body.errors.length > 1) {
errorMsg += ` (${body.errors.length} files failed)`;
}
} else {
errorMsg = body.details
? `${body.error}: ${body.details}`
: body.error || `Batch processing failed: ${response.status}`;
}
} catch {
errorMsg = `Batch processing failed: ${response.status}`;
}