🐛 (openai) Fix 2 openai streaming back to back
This commit is contained in:
@ -39,6 +39,7 @@ export const continueBotFlow = async (
|
||||
reply: string | undefined,
|
||||
{ state, version }: Params
|
||||
): Promise<ChatReply & { newSessionState: SessionState }> => {
|
||||
let firstBubbleWasStreamed = false
|
||||
let newSessionState = { ...state }
|
||||
|
||||
if (!newSessionState.currentBlock) return startBotFlow({ state, version })
|
||||
@ -81,6 +82,7 @@ export const continueBotFlow = async (
|
||||
block.type === IntegrationBlockType.OPEN_AI &&
|
||||
block.options.task === 'Create chat completion'
|
||||
) {
|
||||
firstBubbleWasStreamed = true
|
||||
if (reply) {
|
||||
const result = await resumeChatCompletion(state, {
|
||||
options: block.options,
|
||||
@ -125,7 +127,7 @@ export const continueBotFlow = async (
|
||||
...group,
|
||||
blocks: group.blocks.slice(blockIndex + 1),
|
||||
},
|
||||
{ version, state: newSessionState }
|
||||
{ version, state: newSessionState, firstBubbleWasStreamed }
|
||||
)
|
||||
return {
|
||||
...chatReply,
|
||||
@ -157,6 +159,7 @@ export const continueBotFlow = async (
|
||||
const chatReply = await executeGroup(nextGroup.group, {
|
||||
version,
|
||||
state: newSessionState,
|
||||
firstBubbleWasStreamed,
|
||||
})
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user