Commit 539bc779 by Archer Committed by GitHub

fix: aichat response (#2728)

parent aabbe06e
...@@ -201,13 +201,15 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp ...@@ -201,13 +201,15 @@ 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 || '';
// Some models do not support streaming if (stream) {
workflowStreamResponse?.({ // Some models do not support streaming
event: SseResponseEventEnum.fastAnswer, workflowStreamResponse?.({
data: textAdaptGptResponse({ event: SseResponseEventEnum.fastAnswer,
text: answer data: textAdaptGptResponse({
}) text: answer
}); })
});
}
return { return {
answerText: answer answerText: answer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment