review: format check precedes limits, INVALID_IMAGE/IMAGE_TYPE_MISMATCH as format copy, tile-sized retry control
This commit is contained in:
@@ -38,6 +38,11 @@ export function attachmentErrorText(
|
||||
case 'MODEL_DOES_NOT_SUPPORT_IMAGES': return t('image.modelUnsupported')
|
||||
case 'SUBAGENT_IMAGE_UNSUPPORTED': return t('image.subagentUnsupported')
|
||||
case 'IMAGE_TOO_MANY_PIXELS': return t('image.tooManyPixels')
|
||||
// Undecodable bytes or a declared type its bytes contradict: solvable by
|
||||
// replacing or re-exporting the file, so it reads as a format problem.
|
||||
case 'INVALID_IMAGE':
|
||||
case 'IMAGE_TYPE_MISMATCH':
|
||||
return t('image.unsupportedType')
|
||||
case 'TOO_MANY_IMAGES':
|
||||
if (limits !== undefined) return t('image.tooMany', { count: limits.maxImagesPerMessage })
|
||||
break
|
||||
|
||||
@@ -425,6 +425,12 @@ export function InputBar({
|
||||
if (addImages === undefined || files.length === 0) return
|
||||
const rejected = ((): string | null => {
|
||||
if (imageLimits !== undefined) {
|
||||
// Format precedes limits (DeepSeek Chat's filter order): a batch with
|
||||
// a non-image must announce the format problem, not a count or size
|
||||
// it could never pass anyway — addImages rejects it authoritatively.
|
||||
if (files.some(file => !(imageLimits.mediaTypes as readonly string[]).includes(file.type))) {
|
||||
return addImages(files)
|
||||
}
|
||||
if (attachments.length + files.length > imageLimits.maxImagesPerMessage) {
|
||||
return t('image.tooMany', { count: imageLimits.maxImagesPerMessage })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user