From fc33336db761eaa4a8779059b1028a9adc9b060a Mon Sep 17 00:00:00 2001 From: Arvin Xu Date: Sun, 22 Sep 2024 20:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20fix=20ollama=20model=20do?= =?UTF-8?q?wnload=20panel=20(#4070)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Error/OllamaBizError/InvalidOllamaModel/index.tsx | 6 +++--- src/features/Conversation/Error/OllamaBizError/index.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/features/Conversation/Error/OllamaBizError/InvalidOllamaModel/index.tsx b/src/features/Conversation/Error/OllamaBizError/InvalidOllamaModel/index.tsx index 3e3b81a52c19..a78e17b661cc 100644 --- a/src/features/Conversation/Error/OllamaBizError/InvalidOllamaModel/index.tsx +++ b/src/features/Conversation/Error/OllamaBizError/InvalidOllamaModel/index.tsx @@ -26,7 +26,7 @@ const OllamaModelForm = memo(({ id, model }) => { const [total, setTotal] = useState(0); const { remainingTime, downloadSpeed } = useDownloadMonitor(total, completed); const percent = useMemo(() => { - return total ? Number(((completed / total) * 100).toFixed(0)) : 0; + return total ? Number(((completed / total) * 100).toFixed(1)) : 0; }, [completed, total]); const [delAndRegenerateMessage, deleteMessage] = useChatStore((s) => [ @@ -114,8 +114,8 @@ const OllamaModelForm = memo(({ id, model }) => { !total ? t('ollama.unlock.starting') : t('ollama.unlock.downloaded', { - completed: formatSize(completed), - total: formatSize(total), + completed: formatSize(completed, 2), + total: formatSize(total, 2), })} {isDownloading ? ( diff --git a/src/features/Conversation/Error/OllamaBizError/index.tsx b/src/features/Conversation/Error/OllamaBizError/index.tsx index 856db1b25aa6..c02dd08ba532 100644 --- a/src/features/Conversation/Error/OllamaBizError/index.tsx +++ b/src/features/Conversation/Error/OllamaBizError/index.tsx @@ -23,7 +23,7 @@ interface OllamaErrorResponse { error: OllamaError; } -const UNRESOLVED_MODEL_REGEXP = /model '([\w+,-_]+)' not found/; +const UNRESOLVED_MODEL_REGEXP = /model "([\w+,-_]+)" not found/; const OllamaBizError = memo(({ error, id }) => { const errorBody: OllamaErrorResponse = (error as any)?.body;