Refactor requestChatDataMain function to handle non-multiGen
This commit is contained in:
@@ -575,13 +575,21 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
const choices = JSON.parse(rawChunk).choices
|
const choices = JSON.parse(rawChunk).choices
|
||||||
for(const choice of choices){
|
for(const choice of choices){
|
||||||
const chunk = choice.delta.content
|
const chunk = choice.delta.content
|
||||||
const ind = choice.index.toString()
|
|
||||||
if(chunk){
|
if(chunk){
|
||||||
|
if(multiGen){
|
||||||
|
const ind = choice.index.toString()
|
||||||
if(!readed[ind]){
|
if(!readed[ind]){
|
||||||
readed[ind] = ""
|
readed[ind] = ""
|
||||||
}
|
}
|
||||||
readed[ind] += chunk
|
readed[ind] += chunk
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
if(!readed["0"]){
|
||||||
|
readed["0"] = ""
|
||||||
|
}
|
||||||
|
readed["0"] += chunk
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user