fix: add progress bar and batch download to vectorize tool

The vectorize tool had a custom processing flow that bypassed the
standard useToolProcessor hook -- no progress indication, no server-side
batch, and the Download All ZIP relied on a client-side sequential loop.

Backend: extract core logic into vectorizeBuffer(), register via
registerToolProcessFn() so the /batch endpoint works with p-queue
concurrency and SSE progress events.

Frontend: replace custom fetch loop with useToolProcessor hook and
ProgressCard, giving upload progress, per-file batch status, and
automatic Download All ZIP via the existing tool-page infrastructure.

Also set image/svg+xml MIME type on SVG blobs during batch ZIP
extraction to ensure reliable rendering in <img> tags across browsers.
This commit is contained in:
SnapOtter
2026-05-13 10:36:35 +08:00
parent ac7d9cd591
commit f93e864094
3 changed files with 152 additions and 143 deletions
+5 -1
View File
@@ -392,7 +392,11 @@ export function useToolProcessor(toolId: string) {
for (let i = 0; i < entries.length; i++) {
const processedName = fileResults[String(i)];
if (processedName && extracted[processedName]) {
const blob = new Blob([extracted[processedName] as BlobPart]);
const blobType = processedName.endsWith(".svg") ? "image/svg+xml" : undefined;
const blob = new Blob(
[extracted[processedName] as BlobPart],
blobType ? { type: blobType } : undefined,
);
updateEntry(i, {
processedUrl: URL.createObjectURL(blob),
processedFilename: processedName,