From f83e49bd3d3e27069d180790ed4efc98e8526f2a Mon Sep 17 00:00:00 2001 From: jialin Date: Mon, 31 Mar 2025 12:31:03 +0800 Subject: [PATCH] chore: check compatibility ux --- src/components/alert-info/block.tsx | 13 +- src/components/modal-footer/index.tsx | 33 +- src/components/overlay-scroller/index.tsx | 17 +- src/locales/en-US/models.ts | 10 +- src/locales/ja-JP/models.ts | 12 +- src/locales/ru-RU/models.ts | 10 +- src/locales/zh-CN/models.ts | 5 +- src/pages/llmodels/apis/evaluateWorker.ts | 52 +++ src/pages/llmodels/apis/index.ts | 14 + .../llmodels/components/compatible-alert.tsx | 20 +- src/pages/llmodels/components/data-form.tsx | 343 ++---------------- .../components/deploy-builtin-modal.tsx | 212 ++++++++--- .../llmodels/components/deploy-modal.tsx | 246 ++++++++++--- .../llmodels/components/hf-model-file.tsx | 80 ++-- .../llmodels/components/hf-model-item.tsx | 16 +- .../components/incompatiable-info.tsx | 17 +- src/pages/llmodels/components/model-card.tsx | 4 +- .../llmodels/components/search-model.tsx | 232 +++++++----- .../llmodels/components/search-result.tsx | 4 +- src/pages/llmodels/components/table-list.tsx | 11 +- src/pages/llmodels/config/form-context.ts | 41 +++ src/pages/llmodels/config/index.ts | 23 +- src/pages/llmodels/config/types.ts | 6 + src/pages/llmodels/download/index.tsx | 2 + src/pages/llmodels/forms/catalog.tsx | 84 +++++ src/pages/llmodels/forms/hugging-face.tsx | 68 ++++ src/pages/llmodels/forms/local-path.tsx | 79 ++++ src/pages/llmodels/forms/ollama-library.tsx | 67 ++++ src/pages/llmodels/hooks/index.ts | 51 ++- src/pages/llmodels/style/hf-model-item.less | 1 + 30 files changed, 1191 insertions(+), 582 deletions(-) create mode 100644 src/pages/llmodels/apis/evaluateWorker.ts create mode 100644 src/pages/llmodels/config/form-context.ts create mode 100644 src/pages/llmodels/forms/catalog.tsx create mode 100644 src/pages/llmodels/forms/hugging-face.tsx create mode 100644 src/pages/llmodels/forms/local-path.tsx create mode 100644 src/pages/llmodels/forms/ollama-library.tsx diff --git a/src/components/alert-info/block.tsx b/src/components/alert-info/block.tsx index 60c5ed5f..04ac8988 100644 --- a/src/components/alert-info/block.tsx +++ b/src/components/alert-info/block.tsx @@ -12,6 +12,7 @@ interface AlertInfoProps { icon?: React.ReactNode; ellipsis?: boolean; style?: React.CSSProperties; + contentStyle?: React.CSSProperties; title: React.ReactNode; } @@ -30,7 +31,15 @@ const ContentWrapper = styled.div<{ $hasTitle: boolean }>` `; const AlertInfo: React.FC = (props) => { - const { message, type, rows = 1, ellipsis, style, title } = props; + const { + message, + type, + rows = 1, + ellipsis, + style, + title, + contentStyle + } = props; return ( <> @@ -51,7 +60,7 @@ const AlertInfo: React.FC = (props) => { {title && {title}} - + {message} diff --git a/src/components/modal-footer/index.tsx b/src/components/modal-footer/index.tsx index cac3dbcc..2e437378 100644 --- a/src/components/modal-footer/index.tsx +++ b/src/components/modal-footer/index.tsx @@ -1,5 +1,6 @@ import { useIntl } from '@umijs/max'; import { Button, Space } from 'antd'; +import React from 'react'; type ModalFooterProps = { onOk?: () => void; @@ -9,10 +10,12 @@ type ModalFooterProps = { htmlType?: 'button' | 'submit'; okBtnProps?: any; cancelBtnProps?: any; - align?: 'start' | 'end' | 'center' | 'baseline'; - form?: any; loading?: boolean; style?: React.CSSProperties; + showOkBtn?: boolean; + showCancelBtn?: boolean; + extra?: React.ReactNode; + form?: any; }; const ModalFooter: React.FC = ({ onOk, @@ -23,8 +26,9 @@ const ModalFooter: React.FC = ({ cancelBtnProps, loading, htmlType = 'button', - align = 'end', style, + showOkBtn = true, + extra, form }) => { const intl = useIntl(); @@ -33,16 +37,19 @@ const ModalFooter: React.FC = ({ - + {extra} + {showOkBtn && ( + + )} ); }; diff --git a/src/components/overlay-scroller/index.tsx b/src/components/overlay-scroller/index.tsx index 50eb52ff..adefaa1f 100644 --- a/src/components/overlay-scroller/index.tsx +++ b/src/components/overlay-scroller/index.tsx @@ -10,7 +10,12 @@ const Wrapper = styled.div<{ $maxHeight?: number }>` padding-inline: 10px; `; -const OverlayScroller: React.FC = ({ children, maxHeight, theme }) => { +const OverlayScroller: React.FC = ({ + children, + maxHeight, + theme, + style +}) => { const scroller = React.useRef(null); const { initialize } = useOverlayScroller({ options: { @@ -25,7 +30,15 @@ const OverlayScroller: React.FC = ({ children, maxHeight, theme }) => { }, []); return ( -