Files
LingvAI/utils/replicate-translate.ts
Malin 41d2aa7295 fix: respect JigsawStack 5000-char limit with proper batching
- buildBatches: groups texts into chunks that fit within 4800 chars
  (200 char safety margin) when joined with the separator
- translateLongText: splits individual cells/paragraphs that exceed
  the limit at paragraph/sentence boundaries, translates each chunk,
  then rejoins — instead of hitting the API with oversized input
- Process batches sequentially to avoid overloading the local model
- Separator fallback still works: if separator gets translated,
  falls back to individual calls per text within that batch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 10:26:22 +01:00

8.4 KiB