diff --git a/frontend/src/app-components/inputs/Selectable.tsx b/frontend/src/app-components/inputs/Selectable.tsx index 62d8a6a6..d207dc54 100644 --- a/frontend/src/app-components/inputs/Selectable.tsx +++ b/frontend/src/app-components/inputs/Selectable.tsx @@ -1,12 +1,14 @@ /* - * 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. * 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 { Box, Input, styled } from "@mui/material"; + + +import { Box, CircularProgress, Input, styled } from "@mui/material"; import randomSeed from "random-seed"; import { FC, useCallback, useEffect, useMemo, useRef, useState } from "react"; @@ -62,6 +64,7 @@ type SelectableProps = { text: string; entities: INlpDatasetKeywordEntity[]; }) => void; + loading?: boolean; }; const Selectable: FC = ({ @@ -70,6 +73,7 @@ const Selectable: FC = ({ placeholder = "", onChange, onSelect, + loading = false, }) => { const [text, setText] = useState(defaultValue || ""); const editableRef = useRef(null); @@ -204,6 +208,22 @@ const Selectable: FC = ({ value={text} onChange={(e) => handleTextChange(e.target.value)} placeholder={placeholder} + endAdornment={ + loading ? ( + + ) : null + } /> ); diff --git a/frontend/src/components/nlp/components/NlpTrainForm.tsx b/frontend/src/components/nlp/components/NlpTrainForm.tsx index cb9d595f..11359161 100644 --- a/frontend/src/components/nlp/components/NlpTrainForm.tsx +++ b/frontend/src/components/nlp/components/NlpTrainForm.tsx @@ -1,11 +1,13 @@ /* - * 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. * 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"; import DeleteIcon from "@mui/icons-material/Delete"; @@ -117,8 +119,7 @@ const NlpDatasetSample: FC = ({ }, 400), [setValue], ); - - useQuery({ + const { isLoading } = useQuery({ queryKey: ["nlp-prediction", currentText], queryFn: async () => { return await apiClient.predictNlp(currentText); @@ -140,7 +141,6 @@ const NlpDatasetSample: FC = ({ }, enabled: !sample && !!currentText, }); - const findInsertIndex = (newItem: INlpDatasetKeywordEntity): number => { const index = keywordEntities.findIndex( (entity) => entity.start && newItem.start && entity.start > newItem.start, @@ -226,6 +226,7 @@ const NlpDatasetSample: FC = ({ })), ); }} + loading={isLoading} />