From 1397be4f03b2da551b350d89c47adeb7e45973a6 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Tue, 16 Jan 2024 17:54:42 +0900 Subject: [PATCH] Refactor requestChatDataMain function to handle non-multiGen --- src/ts/process/request.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts index f8697ad4..c72727e5 100644 --- a/src/ts/process/request.ts +++ b/src/ts/process/request.ts @@ -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) {}