mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
Merge 5d41720d2d
into e3094742a2
This commit is contained in:
commit
5290c4d4c4
@ -106,6 +106,7 @@
|
||||
"invalid_carousel_limit": "List limit must be >=1 and <= 10",
|
||||
"no_content_type": "No content type available, please create one first",
|
||||
"invalid_max_fallback_attempt_limit": "Max fallback attempt limit must have positive value",
|
||||
"fallback_message_required": "Fallback message is required",
|
||||
"regex_is_invalid": "Regex is invalid",
|
||||
"regex_is_empty": "Regex cannot be empty",
|
||||
"attachment_not_found": "Attachment is not found",
|
||||
|
@ -106,6 +106,7 @@
|
||||
"invalid_carousel_limit": "La limite doit être >=1 et <= 10",
|
||||
"no_content_type": "Il n'y a aucun type de contenu pour le moment, veuillez en ajouter un.",
|
||||
"invalid_max_fallback_attempt_limit": "La limite des tentatives de secours doit être un nombre positif.",
|
||||
"fallback_message_required": "Le message de secours est requis",
|
||||
"regex_is_invalid": "Le regex est invalide",
|
||||
"regex_is_empty": "Le regex ne peut pas être vide",
|
||||
"attachment_not_found": "La pièce jointe est introuvable",
|
||||
|
@ -104,6 +104,21 @@ export const OptionsForm = () => {
|
||||
name="options.fallback"
|
||||
control={control}
|
||||
defaultValue={block?.options?.fallback}
|
||||
rules={{
|
||||
validate: (value) => {
|
||||
const hasNoValue = !value;
|
||||
const localFallbackDisabled = value?.max_attempts === 0;
|
||||
const hasValidFallbackMessage =
|
||||
Array.isArray(value?.message) &&
|
||||
value.message.some((m) => m?.trim());
|
||||
|
||||
return hasNoValue ||
|
||||
localFallbackDisabled ||
|
||||
hasValidFallbackMessage
|
||||
? true
|
||||
: t("message.fallback_message_required");
|
||||
},
|
||||
}}
|
||||
render={({ field }) => (
|
||||
<LocalFallbackInput
|
||||
value={field?.value}
|
||||
|
@ -95,6 +95,8 @@ const LocalFallbackInput: FC<LocalFallbackProps> = ({ value, onChange }) => {
|
||||
multiline={true}
|
||||
minInput={1}
|
||||
minRows={3}
|
||||
error={!!errors.options?.fallback}
|
||||
helperText={errors.options?.fallback?.message as string}
|
||||
onChange={(message) => {
|
||||
setFallback({
|
||||
...fallback,
|
||||
|
Loading…
Reference in New Issue
Block a user