From 284d9bda36f80fc28d8458bf4b400d90f99e6113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Zechel?= <19580716+zechel@users.noreply.github.com> Date: Wed, 8 Apr 2026 11:12:57 -0300 Subject: [PATCH] Error: Fix of an image in the conversation exceeds the dimension limit for many-image requests (2000px) (#520) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: IMAGE_MAX_WIDTH and IMAGE_MAX_HEIGHT were set to 2000 — exactly the APIs many-image dimension limit. Images resized to exactly 2000px would get rejected when the conversation accumulated enough images to trigger the API's many-image mode. Fix: Changed both constants from 2000 to 1568 in src/constants/apiLimits.ts:42-43. This is the resolution the API internally downscales to anyway (documented in the API's encoding/full_encoding.py), so there is zero effective quality loss. All images are now safely below the many-image threshold. export const IMAGE_MAX_WIDTH = 1568 export const IMAGE_MAX_HEIGHT = 1568 Impact: The single constant change propagates everywhere — imageResizer.ts uses IMAGE_MAX_WIDTH/IMAGE_MAX_HEIGHT for all resize decisions, and the error messages reference these constants dynamically. No other files need changes. --- src/constants/apiLimits.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/constants/apiLimits.ts b/src/constants/apiLimits.ts index 9746b030..a2739843 100644 --- a/src/constants/apiLimits.ts +++ b/src/constants/apiLimits.ts @@ -33,14 +33,14 @@ export const IMAGE_TARGET_RAW_SIZE = (API_IMAGE_MAX_BASE64_SIZE * 3) / 4 // 3.75 * * Note: The API internally resizes images larger than 1568px (source: * encoding/full_encoding.py), but this is handled server-side and doesn't - * cause errors. These client-side limits (2000px) are slightly larger to + * cause errors. These client-side limits (1568px) are slightly larger to * preserve quality when beneficial. * * The API_IMAGE_MAX_BASE64_SIZE (5MB) is the actual hard limit that causes * API errors if exceeded. */ -export const IMAGE_MAX_WIDTH = 2000 -export const IMAGE_MAX_HEIGHT = 2000 +export const IMAGE_MAX_WIDTH = 1568 +export const IMAGE_MAX_HEIGHT = 1568 // ============================================================================= // PDF LIMITS