From baa5f5f6f34f8721eac55f7111b515321975a6e6 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Wed, 26 Jun 2024 15:42:11 +0200 Subject: [PATCH] :ambulance: Fix reply resume chat --- packages/bot-engine/continueBotFlow.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/bot-engine/continueBotFlow.ts b/packages/bot-engine/continueBotFlow.ts index d7d5b8d55..e12066507 100644 --- a/packages/bot-engine/continueBotFlow.ts +++ b/packages/bot-engine/continueBotFlow.ts @@ -92,7 +92,7 @@ export const continueBotFlow = async ( const existingVariable = state.typebotsQueue[0].typebot.variables.find( byId(block.options?.variableId) ) - if (existingVariable && reply && typeof reply === 'string') { + if (existingVariable && reply) { variableToUpdate = { ...existingVariable, } @@ -104,22 +104,18 @@ export const continueBotFlow = async ( block.options?.task === 'Create chat completion' ) { firstBubbleWasStreamed = true - if (reply && typeof reply === 'string') { + if (reply) { const result = await resumeChatCompletion(state, { options: block.options, outgoingEdgeId: block.outgoingEdgeId, - })(reply) + })(reply.text) newSessionState = result.newSessionState } - } else if ( - reply && - block.type === IntegrationBlockType.WEBHOOK && - typeof reply === 'string' - ) { + } else if (reply && block.type === IntegrationBlockType.WEBHOOK) { const result = resumeWebhookExecution({ state, block, - response: JSON.parse(reply), + response: JSON.parse(reply.text), }) if (result.newSessionState) newSessionState = result.newSessionState } else if (isForgedBlockType(block.type)) {