feat: image variants per image

This commit is contained in:
fsylvain committed 2026-10-08 19:57:51 +02:00
1 parent f567866161
commit 951fef18ba
92 files changed
+8695 -413

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import { t } from '@/i18n'
import type { VariantCause } from '@/composables/useMediaVariants'
const PAYLOAD_TOO_LARGE = 413
const UNSUPPORTED_MEDIA_TYPE = 415
const UNPROCESSABLE = 422
export function causeText(cause: string) {
if (cause === 'too_large') {
return t('Image too large')
}
if (cause === 'unsupported_format') {
return t('Unsupported source format')
}
return t('Generation failed')
}
export function causeOfStatus(status: number): VariantCause | null {
if (status === PAYLOAD_TOO_LARGE) {
return 'too_large'
}
if (status === UNSUPPORTED_MEDIA_TYPE || status === UNPROCESSABLE) {
return 'unsupported_format'
}
return null
}