From ab226c8b9d1ca8e0af76255b69c18b8d31082eba Mon Sep 17 00:00:00 2001 From: kwaroran Date: Wed, 24 Apr 2024 00:27:49 +0900 Subject: [PATCH] Fix text handling --- src/ts/process/request.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts index 19b33627..1663683f 100644 --- a/src/ts/process/request.ts +++ b/src/ts/process/request.ts @@ -608,7 +608,7 @@ 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 chunk = choice.delta.content ?? choices.text if(chunk){ if(multiGen){ const ind = choice.index.toString() @@ -703,6 +703,13 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model' } } + + if(dat?.choices[0]?.text){ + return { + type: 'success', + result: dat.choices[0].text + } + } const msg:OpenAIChatFull = (dat.choices[0].message) return { type: 'success',