@@ -95,6 +95,7 @@ export const createChatCompletionOpenAI = async (
|
||||
assistantMessageVariableName
|
||||
),
|
||||
},
|
||||
expectsDedicatedReply: true,
|
||||
},
|
||||
],
|
||||
outgoingEdgeId,
|
||||
|
||||
@@ -64,6 +64,7 @@ export const executeWebhookBlock = async (
|
||||
clientSideActions: [
|
||||
{
|
||||
webhookToExecute: parsedWebhook,
|
||||
expectsDedicatedReply: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ export const executeSetVariable = (
|
||||
setVariable: {
|
||||
scriptToExecute,
|
||||
},
|
||||
expectsDedicatedReply: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ export const executeWait = (
|
||||
? [
|
||||
{
|
||||
wait: { secondsToWaitFor: parsedSecondsToWaitFor },
|
||||
expectsDedicatedReply: block.options.shouldPause,
|
||||
},
|
||||
]
|
||||
: undefined,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { TRPCError } from '@trpc/server'
|
||||
import {
|
||||
AnswerInSessionState,
|
||||
Block,
|
||||
BubbleBlockType,
|
||||
ChatReply,
|
||||
InputBlock,
|
||||
@@ -8,8 +8,6 @@ import {
|
||||
IntegrationBlockType,
|
||||
LogicBlockType,
|
||||
SessionState,
|
||||
SetVariableBlock,
|
||||
WebhookBlock,
|
||||
defaultPaymentInputOptions,
|
||||
invalidEmailDefaultRetryMessage,
|
||||
} from '@typebot.io/schemas'
|
||||
@@ -21,7 +19,6 @@ import { formatPhoneNumber } from '@/features/blocks/inputs/phone/formatPhoneNum
|
||||
import { validateUrl } from '@/features/blocks/inputs/url/validateUrl'
|
||||
import { updateVariables } from '@/features/variables/updateVariables'
|
||||
import { parseVariables } from '@/features/variables/parseVariables'
|
||||
import { OpenAIBlock } from '@typebot.io/schemas/features/blocks/integrations/openai'
|
||||
import { resumeChatCompletion } from '@/features/blocks/integrations/openai/resumeChatCompletion'
|
||||
import { resumeWebhookExecution } from '@/features/blocks/integrations/webhook/resumeWebhookExecution'
|
||||
import { upsertAnswer } from '../queries/upsertAnswer'
|
||||
@@ -80,11 +77,7 @@ export const continueBotFlow =
|
||||
})(reply)
|
||||
newSessionState = result.newSessionState
|
||||
}
|
||||
} else if (!isInputBlock(block))
|
||||
throw new TRPCError({
|
||||
code: 'INTERNAL_SERVER_ERROR',
|
||||
message: 'Current block is not an input block',
|
||||
})
|
||||
}
|
||||
|
||||
let formattedReply: string | undefined
|
||||
|
||||
@@ -276,10 +269,7 @@ const setNewAnswerInState =
|
||||
|
||||
const getOutgoingEdgeId =
|
||||
(state: Pick<SessionState, 'typebotsQueue'>) =>
|
||||
(
|
||||
block: InputBlock | SetVariableBlock | OpenAIBlock | WebhookBlock,
|
||||
reply: string | undefined
|
||||
) => {
|
||||
(block: Block, reply: string | undefined) => {
|
||||
const variables = state.typebotsQueue[0].typebot.variables
|
||||
if (
|
||||
block.type === InputBlockType.CHOICE &&
|
||||
|
||||
@@ -94,10 +94,7 @@ export const executeGroup =
|
||||
]
|
||||
if (
|
||||
executionResponse.clientSideActions?.find(
|
||||
(action) =>
|
||||
'setVariable' in action ||
|
||||
'streamOpenAiChatCompletion' in action ||
|
||||
'webhookToExecute' in action
|
||||
(action) => action.expectsDedicatedReply
|
||||
)
|
||||
) {
|
||||
return {
|
||||
|
||||
@@ -22,10 +22,7 @@ export const saveStateToDatabase = async ({
|
||||
clientSideActions,
|
||||
}: Props) => {
|
||||
const containsSetVariableClientSideAction = clientSideActions?.some(
|
||||
(action) =>
|
||||
'setVariable' in action ||
|
||||
'webhookToExecute' in action ||
|
||||
'streamOpenAiChatCompletion' in action
|
||||
(action) => action.expectsDedicatedReply
|
||||
)
|
||||
|
||||
const isCompleted = Boolean(!input && !containsSetVariableClientSideAction)
|
||||
|
||||
@@ -165,10 +165,7 @@ export const startSession = async ({
|
||||
}
|
||||
|
||||
const clientSideActionsNeedSessionId = clientSideActions?.some(
|
||||
(action) =>
|
||||
'setVariable' in action ||
|
||||
'streamOpenAiChatCompletion' in action ||
|
||||
'webhookToExecute' in action
|
||||
(action) => action.expectsDedicatedReply
|
||||
)
|
||||
|
||||
if (!input && !clientSideActionsNeedSessionId)
|
||||
|
||||
Reference in New Issue
Block a user