From 39efca0d4c1e4cedf140118482284fc2ceb51c4e Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 6 Nov 2025 19:37:05 +0800 Subject: [PATCH] fix: add loading on download button --- src/pages/llmodels/download/index.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pages/llmodels/download/index.tsx b/src/pages/llmodels/download/index.tsx index 7b5cc6c6..a35738bb 100644 --- a/src/pages/llmodels/download/index.tsx +++ b/src/pages/llmodels/download/index.tsx @@ -63,6 +63,7 @@ const DownloadModel: React.FC = (props) => { const [isGGUF, setIsGGUF] = useState(false); const [fileName, setFileName] = useState(''); const modelFileRef = useRef(null); + const [loading, setLoading] = useState(false); const generateModelInfo = () => { if (source === modelSourceMap.huggingface_value) { @@ -87,15 +88,20 @@ const DownloadModel: React.FC = (props) => { setSelectedModel(item); }; - const handleOk = (values: any) => { - onOk({ + const handleOk = async (values: any) => { + setLoading(true); + await onOk({ ...values, source: source, ...generateModelInfo() }); + setLoading(false); }; const handleSumit = () => { + if (loading) { + return; + } form.current?.form?.submit?.(); }; @@ -218,6 +224,9 @@ const DownloadModel: React.FC = (props) => {