From 5be637fd30a23bbf7cee25cfb5f8db24693cbecd Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Sun, 20 Apr 2025 11:53:42 +0100 Subject: [PATCH 1/4] fix(api): resolve block local fallback issue --- api/src/chat/services/bot.service.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/api/src/chat/services/bot.service.ts b/api/src/chat/services/bot.service.ts index fb53bf9c..5dbbf28b 100644 --- a/api/src/chat/services/bot.service.ts +++ b/api/src/chat/services/bot.service.ts @@ -275,7 +275,6 @@ export class BotService { !matchedBlock && event.getMessageType() === IncomingMessageType.message && fallbackOptions.active && - convo.context?.attempt && convo.context.attempt < fallbackOptions.max_attempts ) { // Trigger block fallback From fbbdda2724ae65b6353c7e61a06ac8288f59db70 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Sun, 20 Apr 2025 12:00:16 +0100 Subject: [PATCH 2/4] fix(frontend): update max_attempts default value --- frontend/src/components/visual-editor/constants.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/visual-editor/constants.ts b/frontend/src/components/visual-editor/constants.ts index cdd4349b..748eea6d 100644 --- a/frontend/src/components/visual-editor/constants.ts +++ b/frontend/src/components/visual-editor/constants.ts @@ -20,7 +20,7 @@ export const SIMPLE_TEXT_BLOCK_TEMPLATE: Partial = { patterns: ["Hi"], options: { typing: 0, - fallback: { active: false, max_attempts: 1, message: [] }, + fallback: { active: false, max_attempts: 0, message: [] }, }, message: ["Hi back !"], starts_conversation: false, @@ -30,7 +30,7 @@ export const ATTACHMENT_BLOCK_TEMPLATE: Partial = { patterns: ["image"], options: { typing: 0, - fallback: { active: false, max_attempts: 1, message: [] }, + fallback: { active: false, max_attempts: 0, message: [] }, }, message: { attachment: { @@ -46,7 +46,7 @@ export const QUICK_REPLIES_BLOCK_TEMPLATE: Partial = { patterns: ["colors"], options: { typing: 0, - fallback: { active: false, max_attempts: 1, message: [] }, + fallback: { active: false, max_attempts: 0, message: [] }, }, message: { text: "What's your favorite color?", @@ -71,7 +71,7 @@ export const BUTTONS_BLOCK_TEMPLATE: Partial = { patterns: ["about"], options: { typing: 0, - fallback: { active: false, max_attempts: 1, message: [] }, + fallback: { active: false, max_attempts: 0, message: [] }, }, message: { text: "What would you like to know about us?", @@ -92,7 +92,7 @@ export const LIST_BLOCK_TEMPLATE: Partial = { patterns: ["coffee"], options: { typing: 0, - fallback: { active: false, max_attempts: 1, message: [] }, + fallback: { active: false, max_attempts: 0, message: [] }, content: { display: OutgoingMessageFormat.list, limit: 2, @@ -131,7 +131,7 @@ export const CUSTOM_BLOCK_TEMPLATE: Partial = { capture_vars: [], options: { typing: 0, - fallback: { active: false, max_attempts: 1, message: [] }, + fallback: { active: false, max_attempts: 0, message: [] }, }, starts_conversation: false, message: { From fb1af9839d9b162b128027ae96b4f239b1618ca7 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Wed, 23 Apr 2025 16:42:57 +0100 Subject: [PATCH 3/4] fix: resolve local fallback active state --- .../visual-editor/form/inputs/options/LocalFallbackInput.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/visual-editor/form/inputs/options/LocalFallbackInput.tsx b/frontend/src/components/visual-editor/form/inputs/options/LocalFallbackInput.tsx index de00c0db..8fb116a8 100644 --- a/frontend/src/components/visual-editor/form/inputs/options/LocalFallbackInput.tsx +++ b/frontend/src/components/visual-editor/form/inputs/options/LocalFallbackInput.tsx @@ -70,6 +70,7 @@ const LocalFallbackInput: FC = ({ value, onChange }) => { value >= 0 || t("message.invalid_max_fallback_attempt_limit"), }, + valueAsNumber: true, })} helperText={ errors.options?.fallback?.max_attempts @@ -81,7 +82,7 @@ const LocalFallbackInput: FC = ({ value, onChange }) => { setFallback({ ...fallback, max_attempts: parseInt(e.target.value) || 0, - active: fallback.max_attempts > 0, + active: parseInt(e.target.value) > 0, }); }} /> From 7efdaaf3b0e4780ca22fecbf914302e9018dd6b1 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Wed, 23 Apr 2025 17:18:34 +0100 Subject: [PATCH 4/4] fix: add radix prop --- .../visual-editor/form/inputs/options/LocalFallbackInput.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/visual-editor/form/inputs/options/LocalFallbackInput.tsx b/frontend/src/components/visual-editor/form/inputs/options/LocalFallbackInput.tsx index 8fb116a8..d2539d08 100644 --- a/frontend/src/components/visual-editor/form/inputs/options/LocalFallbackInput.tsx +++ b/frontend/src/components/visual-editor/form/inputs/options/LocalFallbackInput.tsx @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. @@ -82,7 +82,7 @@ const LocalFallbackInput: FC = ({ value, onChange }) => { setFallback({ ...fallback, max_attempts: parseInt(e.target.value) || 0, - active: parseInt(e.target.value) > 0, + active: parseInt(e.target.value, 10) > 0, }); }} />