fix: reduce image resize limit to 2000px for many-image requests (#615)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -236,7 +236,7 @@ const UTI_TO_MEDIA_TYPE: Record<string, string> = {
|
||||
/**
|
||||
* Import image from macOS clipboard, resize if needed, return placeholder.
|
||||
* Uses temp file approach to avoid stdout buffer limits.
|
||||
* Resizes large images to fit within API limits (2048x2048).
|
||||
* Resizes large images to fit within API limits (2000x2000).
|
||||
*/
|
||||
export async function tryImportClipboardImageMac(): Promise<ClipboardImageResult> {
|
||||
if (process.platform !== "darwin") return null;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Follows Codex CLI's approach (codex-rs/utils/image/src/lib.rs)
|
||||
import sharp from "sharp";
|
||||
|
||||
// Conservative limits that work with Anthropic's API (max 8000x8000)
|
||||
// Codex uses 2048x768, we use 2048x2048 for more flexibility with tall screenshots
|
||||
export const MAX_IMAGE_WIDTH = 2048;
|
||||
export const MAX_IMAGE_HEIGHT = 2048;
|
||||
// Anthropic limits: 8000x8000 for single images, but 2000x2000 for many-image requests
|
||||
// We use 2000 to stay safe when conversation history accumulates multiple images
|
||||
export const MAX_IMAGE_WIDTH = 2000;
|
||||
export const MAX_IMAGE_HEIGHT = 2000;
|
||||
|
||||
export interface ResizeResult {
|
||||
data: string; // base64 encoded
|
||||
|
||||
Reference in New Issue
Block a user