Skip to content

Commit 3302e9b

Browse files
committed
Revert changes to npm-app image handler
1 parent 26c20b9 commit 3302e9b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

npm-app/src/utils/image-handler.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@ const SUPPORTED_IMAGE_EXTENSIONS = new Set([
3030
'.tif',
3131
])
3232

33-
// Size limits - research shows Claude/GPT-4V support up to 20MB, but we use practical limits
34-
// for good performance and token efficiency
35-
const MAX_FILE_SIZE = 10 * 1024 * 1024 // 10MB - allow larger files since we can compress
33+
// Size limits - balanced to prevent message truncation while allowing reasonable images
34+
const MAX_FILE_SIZE = 2 * 1024 * 1024 // 2MB - allow larger files for compression
3635
const MAX_TOTAL_SIZE = 5 * 1024 * 1024 // 5MB total
37-
const MAX_BASE64_SIZE = 1 * 1024 * 1024 // 1MB max for base64 after compression
36+
const MAX_BASE64_SIZE = 150 * 1024 // 150KB max for base64 (backend limit ~760KB, so safe margin)
3837

3938
// Compression settings for iterative compression
40-
const COMPRESSION_QUALITIES = [85, 70, 50, 30] // JPEG quality levels to try
41-
const DIMENSION_LIMITS = [1500, 1200, 800, 600] // Max dimensions to try (1500px recommended by Anthropic)
39+
const COMPRESSION_QUALITIES = [80, 60, 40, 20] // JPEG quality levels to try
40+
const DIMENSION_LIMITS = [800, 600, 400, 300] // Max dimensions to try
4241

4342
function normalizeUserProvidedPath(filePath: string): string {
4443
let normalized = filePath

0 commit comments

Comments
 (0)