Plug AI into the upload pipeline — block, tag, transcribe
CoreUpload exposes four opt-in AI hooks that run in the pre-upload pipeline, symmetric to
virusScan. Your hook typically calls a server endpoint fronting AWS Rekognition,
Google Vision, Azure AI, or a local model — the component stays cloud-agnostic.
What you should see: auto-upload is off, so files sit in the queue after the AI pass until you press “Scan & upload”. The analysis result appears against each file before any bytes are sent.
contentModeration— blocking NSFW/safety gate; rejected files never upload.ocr— extract text; stored ontask.metadata.meta.ocrText.autoTag— label objects/scenes; stored ontask.metadata.meta.tags.generateAltText— accessibility captions; stored ontask.metadata.meta.altText.
This demo uses mock hooks (client-side heuristics) so it runs with no cloud
credentials. Files whose name contains
"unsafe" are blocked by the mock moderator.
Real deployments call your endpoint from inside the hook.
Drag & drop files here, or paste from clipboard
AI events appear here...
Wiring (server-backed in production)
const up = CoreUpload.create('#uploader', {
metaFields: [{ id: 'tags' }, { id: 'altText' }],
contentModeration: async (file) => {
const r = await fetch('/ai/moderate', { method: 'POST', body: file });
const { safe, reason } = await r.json();
return safe ? true : { allow: false, reason };
},
ocr: (file) => fetch('/ai/ocr', { method:'POST', body:file }).then(r => r.json()),
autoTag: (file) => fetch('/ai/tag', { method:'POST', body:file }).then(r => r.json()),
generateAltText: (file) => fetch('/ai/caption', { method:'POST', body:file }).then(r => r.text())
});
Enricher results land on task.metadata.meta.*; because this demo declares
matching metaFields (tags, altText), they populate the inline inputs and ship
to the server automatically via the metadata field / X-Upload-Meta header.