fix: aichat response (#2728)

This commit is contained in:
Archer
2024-09-17 23:07:30 +08:00
committed by GitHub
parent aabbe06e41
commit 539bc77934

View File

@@ -201,6 +201,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
const unStreamResponse = response as ChatCompletion; const unStreamResponse = response as ChatCompletion;
const answer = unStreamResponse.choices?.[0]?.message?.content || ''; const answer = unStreamResponse.choices?.[0]?.message?.content || '';
if (stream) {
// Some models do not support streaming // Some models do not support streaming
workflowStreamResponse?.({ workflowStreamResponse?.({
event: SseResponseEventEnum.fastAnswer, event: SseResponseEventEnum.fastAnswer,
@@ -208,6 +209,7 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
text: answer text: answer
}) })
}); });
}
return { return {
answerText: answer answerText: answer