Skip to content

Commit

Permalink
Fix: allow empty choices
Browse files Browse the repository at this point in the history
Some Azure GPT Models seem to return unexpected empty choices array, when streaming, then proceed normaly
  • Loading branch information
FritzTheBat committed Oct 10, 2023
1 parent 08a62df commit 41a2188
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ChatGPTClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ ${botMessage.message}
if (progressMessage === '[DONE]') {
return;
}
const token = this.isChatGptModel ? progressMessage.choices[0].delta.content : progressMessage.choices[0].text;
const token = this.isChatGptModel ? progressMessage.choices[0]?.delta.content : progressMessage.choices[0]?.text;
// first event's delta content is always undefined
if (!token) {
return;
Expand Down

0 comments on commit 41a2188

Please sign in to comment.