mirror of
https://github.com/langgenius/dify.git
synced 2026-10-04 13:47:55 +08:00
Harden the Localizer's batch translation against models that format JSON differently (the Builder model is user-changeable): - correlate by numeric INDEX instead of echoing source strings as keys, so a model that normalizes/truncates long keys no longer misses every lookup - accept the reply as an index-keyed object OR a positional array, optionally wrapped one level (_translations_by_index) - cache only real translations; a failed/partial reply is left UNCACHED so the next turn retries (self-heals) instead of sticking on the English original TDD: added parser shape-variation tests + a no-cache-failure/self-heal test; the fake now speaks the index protocol. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>