mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
Merge pull request #1000 from Hexastack/feat/implement-block-nlp-prioritization-strategy-v3
Feat/implement block nlp prioritization strategy v3
This commit is contained in:
@@ -156,8 +156,7 @@ function StackComponent<T extends GridValidRowModel>({
|
||||
disabled={
|
||||
(isDisabled && isDisabled(params.row)) ||
|
||||
(params.row.builtin &&
|
||||
(requires.includes(PermissionAction.UPDATE) ||
|
||||
requires.includes(PermissionAction.DELETE)))
|
||||
requires.includes(PermissionAction.DELETE))
|
||||
}
|
||||
onClick={() => {
|
||||
action && action(params.row);
|
||||
|
||||
@@ -167,6 +167,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: nlpEntity?.name || "",
|
||||
doc: nlpEntity?.doc || "",
|
||||
lookups: nlpEntity?.lookups || ["keywords"],
|
||||
weight: nlpEntity?.weight || 1,
|
||||
},
|
||||
});
|
||||
const validationRules = {
|
||||
@@ -82,6 +83,7 @@ export const NlpEntityVarForm: FC<ComponentFormProps<INlpEntity>> = ({
|
||||
reset({
|
||||
name: nlpEntity.name,
|
||||
doc: nlpEntity.doc,
|
||||
weight: nlpEntity.weight,
|
||||
});
|
||||
} else {
|
||||
reset();
|
||||
@@ -121,6 +123,7 @@ export const NlpEntityVarForm: FC<ComponentFormProps<INlpEntity>> = ({
|
||||
required
|
||||
autoFocus
|
||||
helperText={errors.name ? errors.name.message : null}
|
||||
disabled={nlpEntity?.builtin}
|
||||
/>
|
||||
</ContentItem>
|
||||
<ContentItem>
|
||||
@@ -128,8 +131,34 @@ export const NlpEntityVarForm: FC<ComponentFormProps<INlpEntity>> = ({
|
||||
label={t("label.doc")}
|
||||
{...register("doc")}
|
||||
multiline={true}
|
||||
disabled={nlpEntity?.builtin}
|
||||
/>
|
||||
</ContentItem>
|
||||
<ContentItem>
|
||||
<Input
|
||||
label={t("label.weight")}
|
||||
{...register("weight", {
|
||||
valueAsNumber: true,
|
||||
required: t("message.weight_required_error"),
|
||||
min: {
|
||||
value: 0.01,
|
||||
message: t("message.weight_positive_number_error"),
|
||||
},
|
||||
validate: (value) =>
|
||||
value && value > 0
|
||||
? true
|
||||
: t("message.weight_positive_number_error"),
|
||||
})}
|
||||
type="number"
|
||||
inputProps={{
|
||||
min: 0,
|
||||
step: 0.01,
|
||||
inputMode: "numeric",
|
||||
}}
|
||||
error={!!errors.weight}
|
||||
helperText={errors.weight?.message}
|
||||
/>
|
||||
</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