Skip to content

Commit

Permalink
🐛 fix: fix ollama model download panel (lobehub#4070)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Sep 22, 2024
1 parent 2d2231f commit fc33336
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const OllamaModelForm = memo<OllamaModelFormProps>(({ 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) => [
Expand Down Expand Up @@ -114,8 +114,8 @@ const OllamaModelForm = memo<OllamaModelFormProps>(({ 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),
})}
</Button>
{isDownloading ? (
Expand Down
2 changes: 1 addition & 1 deletion src/features/Conversation/Error/OllamaBizError/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChatMessage>(({ error, id }) => {
const errorBody: OllamaErrorResponse = (error as any)?.body;
Expand Down

0 comments on commit fc33336

Please sign in to comment.