mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
feat: add weight to nlp entity schema and readapt
This commit is contained in:
committed by
MohamedAliBouhaouala
parent
95e07c84bc
commit
67ce8ebbfc
@@ -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",
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user