add ai job queue
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user