add ai job queue

This commit is contained in:
Garret Patti
2026-04-13 12:29:09 -04:00
parent 8557c80c52
commit fea55594d0
18 changed files with 818 additions and 167 deletions

View File

@@ -269,6 +269,11 @@ export default function ImageLightbox({ url, name, onClose, onPrev, onNext, item
const data = await res.json().catch(() => ({}))
throw new Error((data as { error?: string }).error ?? 'Failed to extract text')
}
if (res.status === 202) {
setExtractError('Queued — check AI Integrations for progress')
setTimeout(() => setExtractError(null), 4000)
return
}
const result = await res.json()
setExtractedText(result.extractedText || null)
setEditedExtractedText(result.extractedText || '')
@@ -385,8 +390,10 @@ export default function ImageLightbox({ url, name, onClose, onPrev, onNext, item
const data = await res.json().catch(() => ({}))
throw new Error((data as { error?: string }).error ?? 'Failed to translate')
}
const result = await res.json()
setTranslatedText(result.translatedText || null)
if (res.status !== 202) {
const result = await res.json()
setTranslatedText(result.translatedText || null)
}
} catch {
// ignore
} finally {