diff --git a/frontend/src/components/nlp/components/NlpTrainForm.tsx b/frontend/src/components/nlp/components/NlpTrainForm.tsx index cb9d595f..1ada8736 100644 --- a/frontend/src/components/nlp/components/NlpTrainForm.tsx +++ b/frontend/src/components/nlp/components/NlpTrainForm.tsx @@ -1,10 +1,12 @@ -/* - * Copyright © 2024 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. - * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). - */ +/* + * 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. + * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). + */ + + import AddIcon from "@mui/icons-material/Add"; import Check from "@mui/icons-material/Check"; @@ -65,6 +67,7 @@ const NlpDatasetSample: FC = ({ hasCount: false, }, ); + const [loading, setLoading] = useState(false); const getNlpValueFromCache = useGetFromCache(EntityType.NLP_VALUE); // eslint-disable-next-line react-hooks/exhaustive-deps const defaultValues: INlpSampleFormAttributes = useMemo( @@ -121,7 +124,12 @@ const NlpDatasetSample: FC = ({ useQuery({ queryKey: ["nlp-prediction", currentText], queryFn: async () => { - return await apiClient.predictNlp(currentText); + setLoading(true); + try{ + return await apiClient.predictNlp(currentText); + }finally{ + setLoading(false); + } }, onSuccess: (result) => { const traitEntities: INlpDatasetTraitEntity[] = result.entities.filter( @@ -226,6 +234,7 @@ const NlpDatasetSample: FC = ({ })), ); }} + loading={loading} />