2
0

🚑 Fix reply resume chat

This commit is contained in:
Baptiste Arnaud
2024-06-26 15:42:11 +02:00
parent b08e374e3e
commit baa5f5f6f3

View File

@@ -92,7 +92,7 @@ export const continueBotFlow = async (
const existingVariable = state.typebotsQueue[0].typebot.variables.find( const existingVariable = state.typebotsQueue[0].typebot.variables.find(
byId(block.options?.variableId) byId(block.options?.variableId)
) )
if (existingVariable && reply && typeof reply === 'string') { if (existingVariable && reply) {
variableToUpdate = { variableToUpdate = {
...existingVariable, ...existingVariable,
} }
@@ -104,22 +104,18 @@ export const continueBotFlow = async (
block.options?.task === 'Create chat completion' block.options?.task === 'Create chat completion'
) { ) {
firstBubbleWasStreamed = true firstBubbleWasStreamed = true
if (reply && typeof reply === 'string') { if (reply) {
const result = await resumeChatCompletion(state, { const result = await resumeChatCompletion(state, {
options: block.options, options: block.options,
outgoingEdgeId: block.outgoingEdgeId, outgoingEdgeId: block.outgoingEdgeId,
})(reply) })(reply.text)
newSessionState = result.newSessionState newSessionState = result.newSessionState
} }
} else if ( } else if (reply && block.type === IntegrationBlockType.WEBHOOK) {
reply &&
block.type === IntegrationBlockType.WEBHOOK &&
typeof reply === 'string'
) {
const result = resumeWebhookExecution({ const result = resumeWebhookExecution({
state, state,
block, block,
response: JSON.parse(reply), response: JSON.parse(reply.text),
}) })
if (result.newSessionState) newSessionState = result.newSessionState if (result.newSessionState) newSessionState = result.newSessionState
} else if (isForgedBlockType(block.type)) { } else if (isForgedBlockType(block.type)) {