diff --git a/src/components/tags-wrapper/theme-tag.tsx b/src/components/tags-wrapper/theme-tag.tsx new file mode 100644 index 00000000..00077a7c --- /dev/null +++ b/src/components/tags-wrapper/theme-tag.tsx @@ -0,0 +1,28 @@ +import useUserSettings from '@/hooks/use-user-settings'; +import { Tag, TagProps } from 'antd'; +import React from 'react'; + +const ThemeTag: React.FC = ({ + opacity, + style, + children, + ...restProps +}) => { + const { userSettings } = useUserSettings(); + const { isDarkTheme } = userSettings; + return ( + + {children} + + ); +}; + +ThemeTag.displayName = 'ThemeTag'; + +export default ThemeTag; diff --git a/src/pages/llmodels/components/catalog-item.tsx b/src/pages/llmodels/components/catalog-item.tsx index da33cbc0..11db6f56 100644 --- a/src/pages/llmodels/components/catalog-item.tsx +++ b/src/pages/llmodels/components/catalog-item.tsx @@ -2,8 +2,9 @@ import fallbackImg from '@/assets/images/img.png'; import AutoTooltip from '@/components/auto-tooltip'; import IconFont from '@/components/icon-font'; import TagWrapper from '@/components/tags-wrapper'; +import ThemeTag from '@/components/tags-wrapper/theme-tag'; import { useIntl } from '@umijs/max'; -import { Tag, Typography } from 'antd'; +import { Typography } from 'antd'; import classNames from 'classnames'; import _ from 'lodash'; import React, { useCallback } from 'react'; @@ -31,9 +32,10 @@ const CatalogItem: React.FC = (props) => { const renderTag = (sItem: any) => { return ( - = (props) => { padding: '2px 6px', borderRadius: 4, fontSize: 12, - opacity: 0.7, height: 22 }} > {sItem}B - + ); }; @@ -119,21 +120,31 @@ const CatalogItem: React.FC = (props) => {
{data.categories.map((sItem, i) => { return ( - + {_.find(modelCategories, { value: sItem })?.label || sItem} - + ); })} {data.capabilities?.length > 0 && data.capabilities.map((sItem, i) => { return ( - + {_.map(_.split(sItem, '/'), (s: string) => { return _.split(s, '_').join(' '); }) .reverse() .join(' ')} - + ); })} {data.sizes?.length > 0 && ( diff --git a/src/pages/llmodels/components/instance-item.tsx b/src/pages/llmodels/components/instance-item.tsx index 02330d59..2a3b963f 100644 --- a/src/pages/llmodels/components/instance-item.tsx +++ b/src/pages/llmodels/components/instance-item.tsx @@ -5,6 +5,7 @@ import RowChildren from '@/components/seal-table/components/row-children'; import SimpleTabel, { ColumnProps } from '@/components/simple-table'; import InfoColumn from '@/components/simple-table/info-column'; import StatusTag from '@/components/status-tag'; +import ThemeTag from '@/components/tags-wrapper/theme-tag'; import { HandlerOptions } from '@/hooks/use-chunk-fetch'; import useDownloadStream from '@/hooks/use-download-stream'; import { ListItem as WorkerListItem } from '@/pages/resources/config/types'; @@ -17,7 +18,7 @@ import { ThunderboltFilled } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; -import { Button, Col, Progress, Row, Tag, Tooltip, notification } from 'antd'; +import { Button, Col, Progress, Row, Tooltip, notification } from 'antd'; import dayjs from 'dayjs'; import _ from 'lodash'; import React, { useCallback, useEffect, useMemo } from 'react'; @@ -480,7 +481,8 @@ const InstanceItem: React.FC = ({ }} title={renderDistributedServer(severList)} > - = ({ textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden', - opacity: 0.75, borderRadius: 12 }} > @@ -499,7 +500,7 @@ const InstanceItem: React.FC = ({ {intl.formatMessage({ id: 'models.table.acrossworker' })} - + ); }; @@ -533,7 +534,8 @@ const InstanceItem: React.FC = ({ } > - = ({ textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden', - opacity: 0.75, borderRadius: 12 }} > @@ -551,7 +552,7 @@ const InstanceItem: React.FC = ({ {intl.formatMessage({ id: 'models.table.cpuoffload' })} - + ); }, [ diff --git a/src/pages/llmodels/components/model-card.tsx b/src/pages/llmodels/components/model-card.tsx index 7f4bee99..79adb554 100644 --- a/src/pages/llmodels/components/model-card.tsx +++ b/src/pages/llmodels/components/model-card.tsx @@ -1,6 +1,7 @@ import IconFont from '@/components/icon-font'; import MarkdownViewer from '@/components/markdown-viewer'; import SimpleOverlay from '@/components/simple-overlay'; +import ThemeTag from '@/components/tags-wrapper/theme-tag'; import useRequestToken from '@/hooks/use-request-token'; import { DownOutlined, @@ -8,7 +9,7 @@ import { RightOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; -import { Button, Empty, Spin, Tag, Tooltip } from 'antd'; +import { Button, Empty, Spin, Tooltip } from 'antd'; import { some } from 'lodash'; import 'overlayscrollbars/overlayscrollbars.css'; import React, { @@ -317,26 +318,29 @@ const ModelCard: React.FC<{
{modelType && ( - - - - {intl.formatMessage({ id: 'models.architecture' })}: - - {modelType} + + + {intl.formatMessage({ id: 'models.architecture' })}: - + {modelType} + )} {isGGUFModel && ( - - GGUF - + + GGUF + )} {!!modelTags.length && modelTags.map((tag: string, index: number) => { return ( - - {tag} - + + {tag} + ); })}
diff --git a/src/pages/llmodels/components/model-file-item.tsx b/src/pages/llmodels/components/model-file-item.tsx index c3e95de4..17e993e7 100644 --- a/src/pages/llmodels/components/model-file-item.tsx +++ b/src/pages/llmodels/components/model-file-item.tsx @@ -1,8 +1,8 @@ import { TooltipOverlayScroller } from '@/components/overlay-scroller'; +import ThemeTag from '@/components/tags-wrapper/theme-tag'; import { convertFileSize } from '@/utils'; import { InfoCircleOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; -import { Tag } from 'antd'; import classNames from 'classnames'; import _ from 'lodash'; import React from 'react'; @@ -29,7 +29,8 @@ const FilePartsTag = (props: { parts: any[] }) => { return ( }> - { { n: parts.length } )} - + ); }; @@ -65,7 +66,8 @@ const ModelFileItem: React.FC = (props) => { const quanType = getFileType(path); if (quanType) { return ( - = (props) => { }} > {_.toUpper(quanType)} - + ); } return null; @@ -91,7 +93,8 @@ const ModelFileItem: React.FC = (props) => {
{item.path}
- = (props) => { }} > {convertFileSize(item.size)} - + {getModelQuantizationType(item)} diff --git a/src/pages/llmodels/style/hf-model-file.less b/src/pages/llmodels/style/hf-model-file.less index 564d9e14..5c87d034 100644 --- a/src/pages/llmodels/style/hf-model-file.less +++ b/src/pages/llmodels/style/hf-model-file.less @@ -37,7 +37,6 @@ border-radius: 4px; font-size: 12px; height: 22px; - opacity: 0.7; } .btn { diff --git a/src/pages/login/components/styles.less b/src/pages/login/components/styles.less index ad9f6c9a..d33ccfbd 100644 --- a/src/pages/login/components/styles.less +++ b/src/pages/login/components/styles.less @@ -4,7 +4,7 @@ width: max-content; height: max-content; padding: 32px; - background-color: rgba(255, 255, 255, 90%); + background-color: var(--ant-modal-content-bg); :global(.field-wrapper) { background-color: transparent !important; diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index bdae7520..64fa8085 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -3,6 +3,7 @@ import { userAtom } from '@/atoms/user'; import Footer from '@/components/footer'; import useUserSettings from '@/hooks/use-user-settings'; import { useModel } from '@umijs/max'; +import { ConfigProvider, theme } from 'antd'; import { useAtom } from 'jotai'; import { useEffect } from 'react'; import styled from 'styled-components'; @@ -37,7 +38,7 @@ const FormWrapper = styled.div` width: max-content; height: max-content; padding: 32px; - background-color: rgba(255, 255, 255, 90%); + background-color: var(--ant-modal-content-bg); .field-wrapper { background-color: transparent !important; @@ -49,10 +50,15 @@ const FormWrapper = styled.div` `; const Login = () => { - const { themeData } = useUserSettings(); + const { themeData, userSettings } = useUserSettings(); + const { token } = theme.useToken(); const [userInfo, setUserInfo] = useAtom(userAtom); const { initialState, setInitialState } = useModel('@@initialState') || {}; + const globalCssvars: Record = { + '--ant-modal-content-bg': 'rgba(255, 255, 255, 0.9)' + }; + const gotoDefaultPage = async (userInfo: any) => { if (!userInfo || userInfo?.require_password_change) { return; @@ -74,15 +80,30 @@ const Login = () => { }, []); return ( -
- - - - {userInfo?.require_password_change ? : } - -
- -
+ +
+ + + + {userInfo?.require_password_change ? ( + + ) : ( + + )} + +
+
); };