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
@@ -348,6 +348,7 @@
|
||||
"nlp_lookup_trait": "Trait",
|
||||
"doc": "Documentation",
|
||||
"builtin": "Built-in?",
|
||||
"weight": "Weight",
|
||||
"dataset": "Dataset",
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
|
||||
@@ -347,6 +347,7 @@
|
||||
"nlp_lookup_trait": "Trait",
|
||||
"synonyms": "Synonymes",
|
||||
"doc": "Documentation",
|
||||
"weight": "Poids",
|
||||
"builtin": "Intégré?",
|
||||
"dataset": "Données",
|
||||
"yes": "Oui",
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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.
|
||||
@@ -19,6 +19,7 @@ export interface INlpEntityAttributes {
|
||||
lookups: Lookup[];
|
||||
doc?: string;
|
||||
builtin?: boolean;
|
||||
weight: number;
|
||||
}
|
||||
|
||||
export enum NlpLookups {
|
||||
|
||||
Reference in New Issue
Block a user