feat: refactor helpers (nlu)

This commit is contained in:
Mohamed Marrouchi
2024-10-21 15:09:59 +01:00
parent b2c32fe27d
commit b7eef89981
53 changed files with 901 additions and 731 deletions

View File

@@ -19,6 +19,7 @@ import { PasswordInput } from "@/app-components/inputs/PasswordInput";
import { useTranslate } from "@/hooks/useTranslate";
import { EntityType, Format } from "@/services/types";
import { IBlock } from "@/types/block.types";
import { IHelper } from "@/types/helper.types";
import { ISetting } from "@/types/setting.types";
import { MIME_TYPES } from "@/utils/attachment";
@@ -115,11 +116,29 @@ const SettingInput: React.FC<RenderSettingInputProps> = ({
format={Format.BASIC}
labelKey="name"
label={t("label.fallback_block")}
helperText={t("help.fallback_block")}
multiple={false}
onChange={(_e, selected, ..._) => onChange(selected?.id)}
{...rest}
/>
);
} else if (setting.label === "default_nlu_helper") {
const { onChange, ...rest } = field;
return (
<AutoCompleteEntitySelect<IHelper, "name", false>
searchFields={["name"]}
entity={EntityType.NLU_HELPER}
format={Format.BASIC}
labelKey="name"
idKey="name"
label={t("label.default_nlu_helper")}
helperText={t("help.default_nlu_helper")}
multiple={false}
onChange={(_e, selected, ..._) => onChange(selected?.name)}
{...rest}
/>
);
}
return (