Refactor requestChatDataMain function to handle non-multiGen

This commit is contained in:
kwaroran
2024-01-16 17:54:42 +09:00
parent 1b1c6ad2fd
commit 1397be4f03

View File

@@ -575,12 +575,20 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
const choices = JSON.parse(rawChunk).choices
for(const choice of choices){
const chunk = choice.delta.content
const ind = choice.index.toString()
if(chunk){
if(!readed[ind]){
readed[ind] = ""
if(multiGen){
const ind = choice.index.toString()
if(!readed[ind]){
readed[ind] = ""
}
readed[ind] += chunk
}
else{
if(!readed["0"]){
readed["0"] = ""
}
readed["0"] += chunk
}
readed[ind] += chunk
}
}
} catch (error) {}