🐛 fix azure openai 'choices' parameter is empty (#60)

This commit is contained in:
Buer 2023-11-08 18:33:45 +08:00 committed by GitHub
parent ed7b9b7dda
commit 64e8945122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -162,7 +162,7 @@ export class ChatGPTApi implements LLMApi {
const text = msg.data; const text = msg.data;
try { try {
const json = JSON.parse(text); const json = JSON.parse(text);
const delta = json.choices[0].delta.content; const delta = json.choices[0]?.delta.content;
if (delta) { if (delta) {
responseText += delta; responseText += delta;
options.onUpdate?.(responseText, delta); options.onUpdate?.(responseText, delta);