diff --git a/apps/viewer/src/features/chat/api/continueChat.ts b/apps/viewer/src/features/chat/api/continueChat.ts index fc85c8b91..a6f2ffd09 100644 --- a/apps/viewer/src/features/chat/api/continueChat.ts +++ b/apps/viewer/src/features/chat/api/continueChat.ts @@ -113,7 +113,7 @@ export const continueChat = publicProcedure : computeCurrentProgress({ typebotsQueue: newSessionState.typebotsQueue, progressMetadata: newSessionState.progressMetadata, - currentInputBlockId: input?.id as string, + currentInputBlockId: input?.id, }) : undefined, } diff --git a/apps/viewer/src/features/chat/api/startChat.ts b/apps/viewer/src/features/chat/api/startChat.ts index 1f01298ed..01fa45725 100644 --- a/apps/viewer/src/features/chat/api/startChat.ts +++ b/apps/viewer/src/features/chat/api/startChat.ts @@ -109,7 +109,7 @@ export const startChat = publicProcedure : computeCurrentProgress({ typebotsQueue: newSessionState.typebotsQueue, progressMetadata: newSessionState.progressMetadata, - currentInputBlockId: input?.id as string, + currentInputBlockId: input?.id, }) : undefined, } diff --git a/apps/viewer/src/features/chat/api/startChatPreview.ts b/apps/viewer/src/features/chat/api/startChatPreview.ts index 8d7f0ed5e..4d473af74 100644 --- a/apps/viewer/src/features/chat/api/startChatPreview.ts +++ b/apps/viewer/src/features/chat/api/startChatPreview.ts @@ -98,7 +98,7 @@ export const startChatPreview = publicProcedure : computeCurrentProgress({ typebotsQueue: newSessionState.typebotsQueue, progressMetadata: newSessionState.progressMetadata, - currentInputBlockId: input?.id as string, + currentInputBlockId: input?.id, }) : undefined, } diff --git a/packages/bot-engine/computeCurrentProgress.ts b/packages/bot-engine/computeCurrentProgress.ts index 9a3c5f11c..c5ce72d8c 100644 --- a/packages/bot-engine/computeCurrentProgress.ts +++ b/packages/bot-engine/computeCurrentProgress.ts @@ -5,7 +5,7 @@ import { Block, SessionState } from '@typebot.io/schemas' type Props = { typebotsQueue: SessionState['typebotsQueue'] progressMetadata: NonNullable - currentInputBlockId: string + currentInputBlockId: string | undefined } export const computeCurrentProgress = ({ @@ -13,6 +13,7 @@ export const computeCurrentProgress = ({ progressMetadata, currentInputBlockId, }: Props) => { + if (!currentInputBlockId) return const paths = computePossibleNextInputBlocks({ typebotsQueue: typebotsQueue, blockId: currentInputBlockId,