2
0

Add dynamic timeout to bot engine api

This commit is contained in:
Baptiste Arnaud
2023-12-08 13:43:58 +00:00
parent 8819e9e567
commit 957eaf33dd
16 changed files with 124 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.2.25",
"version": "0.2.26",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",

View File

@@ -170,13 +170,20 @@ export const ConversationContainer = (props: Props) => {
setIsSending(false)
if (error) {
setHasError(true)
props.onNewLogs?.([
const errorLogs = [
{
description: 'Failed to send the reply',
details: error,
status: 'error',
},
])
]
await saveClientLogsQuery({
apiHost: props.context.apiHost,
sessionId: props.initialChatReply.sessionId,
clientLogs: errorLogs,
})
props.onNewLogs?.(errorLogs)
return
}
if (!data) return
if (data.lastMessageNewFormat) {

View File

@@ -103,6 +103,7 @@ export const InputChatBlock = (props: Props) => {
block={props.block}
inputIndex={props.inputIndex}
isInputPrefillEnabled={props.isInputPrefillEnabled}
existingAnswer={props.hasError ? answer() : undefined}
onTransitionEnd={props.onTransitionEnd}
onSubmit={handleSubmit}
onSkip={handleSkip}
@@ -118,6 +119,7 @@ const Input = (props: {
block: NonNullable<ContinueChatResponse['input']>
inputIndex: number
isInputPrefillEnabled: boolean
existingAnswer?: string
onTransitionEnd: () => void
onSubmit: (answer: InputSubmitContent) => void
onSkip: (label: string) => void
@@ -125,7 +127,8 @@ const Input = (props: {
const onSubmit = (answer: InputSubmitContent) => props.onSubmit(answer)
const getPrefilledValue = () =>
props.isInputPrefillEnabled ? props.block.prefilledValue : undefined
props.existingAnswer ??
(props.isInputPrefillEnabled ? props.block.prefilledValue : undefined)
const submitPaymentSuccess = () =>
props.onSubmit({

View File

@@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.2.25",
"version": "0.2.26",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.2.25",
"version": "0.2.26",
"description": "Convenient library to display typebots on your React app",
"main": "dist/index.js",
"types": "dist/index.d.ts",