feat: add weight to nlp entity schema and readapt

This commit is contained in:
Mohamed Marrouchi
2025-04-02 11:57:57 +01:00
committed by MohamedAliBouhaouala
parent 95e07c84bc
commit 67ce8ebbfc
14 changed files with 61 additions and 20 deletions

View File

@@ -165,6 +165,16 @@ const NlpEntity = () => {
resizable: false,
renderHeader,
},
{
maxWidth: 210,
field: "weight",
headerName: t("label.weight"),
renderCell: (val) => <Chip label={val.value} variant="title" />,
sortable: true,
disableColumnMenu: true,
resizable: false,
renderHeader,
},
{
maxWidth: 90,
field: "builtin",

View File

@@ -60,6 +60,7 @@ export const NlpEntityVarForm: FC<ComponentFormProps<INlpEntity>> = ({
name: data?.name || "",
doc: data?.doc || "",
lookups: data?.lookups || ["keywords"],
weight: data?.weight || 1,
},
});
const validationRules = {
@@ -82,6 +83,7 @@ export const NlpEntityVarForm: FC<ComponentFormProps<INlpEntity>> = ({
reset({
name: data.name,
doc: data.doc,
weight: data.weight,
});
} else {
reset();
@@ -130,6 +132,14 @@ export const NlpEntityVarForm: FC<ComponentFormProps<INlpEntity>> = ({
multiline={true}
/>
</ContentItem>
<ContentItem>
<Input
label={t("label.weight")}
{...register("weight", { valueAsNumber: true })}
type="number"
inputProps={{ min: 1, step: 1 }} // Restricts input to positive integers only
/>
</ContentItem>
</ContentContainer>
</form>
</Wrapper>