fix: completions delta

This commit is contained in:
archer
2023-08-10 13:15:26 +08:00
parent f70a988574
commit 4dc0fd3c3f
2 changed files with 2 additions and 2 deletions

View File

@@ -74,7 +74,7 @@ export const streamFetch = ({
if (!eventName || !data) return;
if (eventName === sseResponseEventEnum.answer && data !== '[DONE]') {
const answer: string = data?.choices?.[0].delta.content || '';
const answer: string = data?.choices?.[0]?.delta?.content || '';
onMessage({ text: answer });
responseText += answer;
} else if (

View File

@@ -324,7 +324,7 @@ async function streamResponse({
const { data } = parseData.parse(item);
if (!data || data === '[DONE]') return;
const content: string = data?.choices?.[0].delta.content || '';
const content: string = data?.choices?.[0]?.delta?.content || '';
error = data.error;
answer += content;