Skip to content

Commit

Permalink
fix: aichat response (#2728)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Sep 17, 2024
1 parent aabbe06 commit 539bc77
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/service/core/workflow/dispatch/chat/oneapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,15 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
const unStreamResponse = response as ChatCompletion;
const answer = unStreamResponse.choices?.[0]?.message?.content || '';

// Some models do not support streaming
workflowStreamResponse?.({
event: SseResponseEventEnum.fastAnswer,
data: textAdaptGptResponse({
text: answer
})
});
if (stream) {
// Some models do not support streaming
workflowStreamResponse?.({
event: SseResponseEventEnum.fastAnswer,
data: textAdaptGptResponse({
text: answer
})
});
}

return {
answerText: answer
Expand Down

0 comments on commit 539bc77

Please sign in to comment.