2
0

🐛 (openai) Fix 2 openai streaming back to back

This commit is contained in:
Baptiste Arnaud
2023-10-12 13:59:03 +02:00
parent a48026c707
commit 42fd6037f7
8 changed files with 30 additions and 16 deletions

View File

@ -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 {