Shrink translation batches to 20 strings and raise the model token cap - 45-string batches truncated the JSON reply
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@
|
||||
var nodes=collect(root||document.body);
|
||||
var uniq=[],idx={};
|
||||
nodes.forEach(function(n){ var t=n.nodeValue.trim(); if(!(t in idx)&&memo[t]==null){ idx[t]=uniq.length; uniq.push(t);} });
|
||||
var chunks=[]; for(var i=0;i<uniq.length;i+=45)chunks.push(uniq.slice(i,i+45));
|
||||
var chunks=[]; for(var i=0;i<uniq.length;i+=20)chunks.push(uniq.slice(i,i+20));
|
||||
var p=Promise.resolve();
|
||||
chunks.forEach(function(ch){
|
||||
p=p.then(function(){
|
||||
|
||||
Reference in New Issue
Block a user