Merge pull request #944 from Hexastack/115-issue-fallback-message-shouldnt-be-ignored
Some checks failed
Build and Push Docker API Image / build-and-push (push) Has been cancelled
Build and Push Docker Base Image / build-and-push (push) Has been cancelled
Build and Push Docker UI Image / build-and-push (push) Has been cancelled

fix: Resolve block local fallback issue
This commit is contained in:
Yassine
2025-04-25 09:53:57 +01:00
committed by GitHub
3 changed files with 9 additions and 9 deletions

View File

@@ -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

View File

@@ -20,7 +20,7 @@ export const SIMPLE_TEXT_BLOCK_TEMPLATE: Partial<IBlockAttributes> = {
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<IBlockAttributes> = {
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<IBlockAttributes> = {
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<IBlockAttributes> = {
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<IBlockAttributes> = {
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<IBlockAttributes> = {
capture_vars: [],
options: {
typing: 0,
fallback: { active: false, max_attempts: 1, message: [] },
fallback: { active: false, max_attempts: 0, message: [] },
},
starts_conversation: false,
message: {

View File

@@ -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.
@@ -70,6 +70,7 @@ const LocalFallbackInput: FC<LocalFallbackProps> = ({ 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<LocalFallbackProps> = ({ value, onChange }) => {
setFallback({
...fallback,
max_attempts: parseInt(e.target.value) || 0,
active: fallback.max_attempts > 0,
active: parseInt(e.target.value, 10) > 0,
});
}}
/>