fix: backend framework options
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import { memo } from 'react';
|
|
||||||
import CodeViewer from './code-viewer';
|
import CodeViewer from './code-viewer';
|
||||||
import './styles/dark.less';
|
import './styles/dark.less';
|
||||||
|
|
||||||
@@ -38,4 +37,4 @@ const DarkViewer: React.FC<CodeViewerProps> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(DarkViewer);
|
export default DarkViewer;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { memo } from 'react';
|
|
||||||
import CodeViewer from './code-viewer';
|
import CodeViewer from './code-viewer';
|
||||||
import './styles/light.less';
|
import './styles/light.less';
|
||||||
|
|
||||||
@@ -39,4 +38,4 @@ const LightViewer: React.FC<CodeViewerProps> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(LightViewer);
|
export default LightViewer;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import hljs from 'highlight.js';
|
import hljs from 'highlight.js';
|
||||||
import { memo, useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import CopyButton from '../copy-button';
|
import CopyButton from '../copy-button';
|
||||||
import { escapeHtml } from './utils';
|
import { escapeHtml } from './utils';
|
||||||
@@ -155,4 +155,4 @@ const CodeViewer: React.FC<CodeViewerProps> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(CodeViewer);
|
export default CodeViewer;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import classNames from 'classnames';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import {
|
import {
|
||||||
forwardRef,
|
forwardRef,
|
||||||
memo,
|
|
||||||
useEffect,
|
useEffect,
|
||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
useRef,
|
useRef,
|
||||||
@@ -176,4 +175,4 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
export default memo(LogsViewer);
|
export default LogsViewer;
|
||||||
|
|||||||
+2
-2
@@ -49,7 +49,7 @@ export const WatchEventType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const PasswordReg =
|
export const PasswordReg =
|
||||||
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*_+])[a-zA-Z\d!@#$%^&*_+]{6,12}$/;
|
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*_+])[a-zA-Z\d!@#$%^&*_+]{6,32}$/;
|
||||||
|
|
||||||
export const uppercaseReg = /(?=.*[A-Z])/;
|
export const uppercaseReg = /(?=.*[A-Z])/;
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ export const specialCharacterReg = /(?=.*[\W_])/;
|
|||||||
|
|
||||||
export const noSpaceReg = /(?=\S+$)/;
|
export const noSpaceReg = /(?=\S+$)/;
|
||||||
|
|
||||||
export const lengthReg = /^.{6,12}$/;
|
export const lengthReg = /^.{6,32}$/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model name rules:
|
* Model name rules:
|
||||||
|
|||||||
+51
-45
@@ -10,30 +10,38 @@ import {
|
|||||||
DiscordOutlined,
|
DiscordOutlined,
|
||||||
GithubOutlined,
|
GithubOutlined,
|
||||||
HomeOutlined,
|
HomeOutlined,
|
||||||
InfoCircleOutlined,
|
|
||||||
LogoutOutlined,
|
LogoutOutlined,
|
||||||
ReadOutlined,
|
ReadOutlined,
|
||||||
SettingOutlined
|
SettingOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { history, useIntl, useNavigate } from '@umijs/max';
|
import { history, useIntl, useNavigate } from '@umijs/max';
|
||||||
import { Avatar, Divider, Modal } from 'antd';
|
import { Avatar, Button, Divider, Modal } from 'antd';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { DEFAULT_ENTER_PAGE } from '../config/settings';
|
import { DEFAULT_ENTER_PAGE } from '../config/settings';
|
||||||
|
|
||||||
|
const UpdateDot = styled.span`
|
||||||
|
margin-left: 5px;
|
||||||
|
display: flex;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: var(--ant-orange-5);
|
||||||
|
`;
|
||||||
|
|
||||||
const NewLabel = styled.span`
|
const NewLabel = styled.span`
|
||||||
position: relative;
|
position: relative;
|
||||||
bottom: 3px;
|
top: -4px;
|
||||||
|
right: 4px;
|
||||||
|
padding: 2px 4px;
|
||||||
display: flex;
|
display: flex;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
width: 36px;
|
|
||||||
height: 15px;
|
height: 15px;
|
||||||
margin-left: 5px;
|
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: var(--ant-orange-5);
|
background-color: var(--ant-orange-5);
|
||||||
border-radius: 8px 8px 8px 0;
|
border-radius: 6px 6px 6px 0;
|
||||||
transform: scale(0.9);
|
transform: scale(0.9);
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
@@ -187,11 +195,6 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
|||||||
icon: <ReadOutlined />,
|
icon: <ReadOutlined />,
|
||||||
label: intl.formatMessage({ id: 'common.button.docs' }),
|
label: intl.formatMessage({ id: 'common.button.docs' }),
|
||||||
url: externalLinks.documentation
|
url: externalLinks.documentation
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'version',
|
|
||||||
icon: <InfoCircleOutlined />,
|
|
||||||
label: intl.formatMessage({ id: 'common.button.version' })
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -201,27 +204,14 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
|||||||
label: (
|
label: (
|
||||||
<span className="flex flex-center">
|
<span className="flex flex-center">
|
||||||
{item.icon}
|
{item.icon}
|
||||||
{item.key === 'version' ? (
|
<a
|
||||||
<>
|
className="m-l-8 "
|
||||||
<a className="m-l-8">{item.label}</a>
|
href={item.url}
|
||||||
{showUpgrade && (
|
target="_blank"
|
||||||
<NewLabel>
|
rel="noreferrer"
|
||||||
<span className="text">
|
>
|
||||||
{intl.formatMessage({ id: 'common.text.new' })}
|
{item.label}
|
||||||
</span>
|
</a>
|
||||||
</NewLabel>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<a
|
|
||||||
className="m-l-8 "
|
|
||||||
href={item.url}
|
|
||||||
target="_blank"
|
|
||||||
rel="noreferrer"
|
|
||||||
>
|
|
||||||
{item.label}
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
onClick() {
|
onClick() {
|
||||||
@@ -301,21 +291,37 @@ export const ExtraContent = (props: { isDarkTheme?: boolean }) => {
|
|||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
{contextHolder}
|
{contextHolder}
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
onClick={showVersion}
|
||||||
|
style={{
|
||||||
|
color: 'var(--ant-color-text-tertiary)'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{version.version}
|
||||||
|
</Button>
|
||||||
|
{showUpgrade && (
|
||||||
|
<NewLabel>
|
||||||
|
<span className="text">
|
||||||
|
{intl.formatMessage({ id: 'common.text.new' })}
|
||||||
|
</span>
|
||||||
|
</NewLabel>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<DropDownActions menu={{ ...helpMenu }} popupRender={helpPopupRender}>
|
<DropDownActions menu={{ ...helpMenu }} popupRender={helpPopupRender}>
|
||||||
<IconWrapper>
|
<IconWrapper>
|
||||||
<IconFont type="icon-help" className="font-size-20" />
|
<IconFont
|
||||||
{showUpgrade && (
|
type="icon-help"
|
||||||
<span
|
className="font-size-20"
|
||||||
className="m-l-5"
|
style={{ color: 'var(--ant-color-text-tertiary)' }}
|
||||||
style={{
|
/>
|
||||||
display: 'flex',
|
|
||||||
width: 8,
|
|
||||||
height: 8,
|
|
||||||
borderRadius: 4,
|
|
||||||
backgroundColor: 'var(--ant-orange-5)'
|
|
||||||
}}
|
|
||||||
></span>
|
|
||||||
)}
|
|
||||||
</IconWrapper>
|
</IconWrapper>
|
||||||
</DropDownActions>
|
</DropDownActions>
|
||||||
<DropDownActions menu={{ ...userMenu }} popupRender={userPopupRender}>
|
<DropDownActions menu={{ ...userMenu }} popupRender={userPopupRender}>
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ const VersionList: React.FC<{ versionConfigs: VersionListItem[] }> = ({
|
|||||||
<span>
|
<span>
|
||||||
{option.label}
|
{option.label}
|
||||||
{data.tips ? (
|
{data.tips ? (
|
||||||
data.locale ? (
|
data.tipLocale ? (
|
||||||
<span className="text-tertiary m-l-4">{` [${intl.formatMessage({ id: data.tips })}]`}</span>
|
<span className="text-tertiary m-l-4">{` [${intl.formatMessage({ id: data.tips })}]`}</span>
|
||||||
) : (
|
) : (
|
||||||
<span className="text-tertiary m-l-4">{` [${data.tips}]`}</span>
|
<span className="text-tertiary m-l-4">{` [${data.tips}]`}</span>
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ export default function useClusterList() {
|
|||||||
name: string;
|
name: string;
|
||||||
}[]
|
}[]
|
||||||
>([]);
|
>([]);
|
||||||
const [, setClusterListAtom] = useAtom(clusterListAtom);
|
const [clustersAtom, setClusterListAtom] = useAtom(clusterListAtom);
|
||||||
const [, setWorkerListAtom] = useAtom(workerListAtom);
|
const [workersAtom, setWorkerListAtom] = useAtom(workerListAtom);
|
||||||
|
|
||||||
const fetchClusterList = async () => {
|
const fetchClusterList = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -85,6 +85,8 @@ export default function useClusterList() {
|
|||||||
return {
|
return {
|
||||||
clusterList,
|
clusterList,
|
||||||
workerList,
|
workerList,
|
||||||
|
clustersAtom,
|
||||||
|
workersAtom,
|
||||||
fetchAll,
|
fetchAll,
|
||||||
fetchWorkerList,
|
fetchWorkerList,
|
||||||
fetchClusterList
|
fetchClusterList
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { modelCategoriesMap } from '@/pages/llmodels/config';
|
|||||||
import { convertFileSize } from '@/utils';
|
import { convertFileSize } from '@/utils';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Col, Row, Table } from 'antd';
|
import { Col, Row, Table } from 'antd';
|
||||||
import { memo, useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { DashboardContext } from '../config/dashboard-context';
|
import { DashboardContext } from '../config/dashboard-context';
|
||||||
|
|
||||||
const NACategories = [
|
const NACategories = [
|
||||||
@@ -96,4 +96,4 @@ const ActiveTable = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(ActiveTable);
|
export default ActiveTable;
|
||||||
|
|||||||
@@ -74,4 +74,4 @@ const Overview: React.FC = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(Overview);
|
export default Overview;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import LineChart from '@/components/echarts/line-chart';
|
|||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { memo, useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
|
|
||||||
const TypeKeyMap = {
|
const TypeKeyMap = {
|
||||||
cpu: {
|
cpu: {
|
||||||
@@ -106,4 +106,4 @@ const UtilizationOvertime: React.FC<{
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(UtilizationOvertime);
|
export default UtilizationOvertime;
|
||||||
|
|||||||
@@ -12,9 +12,13 @@ import { DashboardProps } from './config/types';
|
|||||||
|
|
||||||
const Dashboard: React.FC = () => {
|
const Dashboard: React.FC = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loadingStatus, setLoadingStatus] = useState({
|
||||||
|
loading: false,
|
||||||
|
loadend: false
|
||||||
|
});
|
||||||
const [data, setData] = useState<DashboardProps>({} as DashboardProps);
|
const [data, setData] = useState<DashboardProps>({} as DashboardProps);
|
||||||
const { fetchAll, clusterList, workerList } = useClusterList();
|
const { fetchAll, clusterList, workerList, clustersAtom, workersAtom } =
|
||||||
|
useClusterList();
|
||||||
|
|
||||||
const { noResourceResult } = useNoResourceResult({
|
const { noResourceResult } = useNoResourceResult({
|
||||||
loadend: true,
|
loadend: true,
|
||||||
@@ -47,16 +51,22 @@ const Dashboard: React.FC = () => {
|
|||||||
|
|
||||||
const initData = useMemoizedFn(async () => {
|
const initData = useMemoizedFn(async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoadingStatus({
|
||||||
|
loading: true,
|
||||||
|
loadend: false
|
||||||
|
});
|
||||||
const { hasClusters, hasWorkers } = await fetchAll();
|
const { hasClusters, hasWorkers } = await fetchAll();
|
||||||
if (!hasClusters || !hasWorkers) {
|
if (!hasClusters || !hasWorkers) {
|
||||||
setLoading(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await fetchDashboardData();
|
await fetchDashboardData();
|
||||||
setLoading(false);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false);
|
// ignore
|
||||||
|
} finally {
|
||||||
|
setLoadingStatus({
|
||||||
|
loading: false,
|
||||||
|
loadend: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -69,11 +79,11 @@ const Dashboard: React.FC = () => {
|
|||||||
value={{ ...data, fetchData: fetchDashboardData, clusterList }}
|
value={{ ...data, fetchData: fetchDashboardData, clusterList }}
|
||||||
>
|
>
|
||||||
<PageBox>
|
<PageBox>
|
||||||
<Spin spinning={loading} style={{ minHeight: 300 }}>
|
<Spin spinning={loadingStatus.loading} style={{ minHeight: 300 }}>
|
||||||
{(!clusterList.length || !workerList.length) && !loading ? (
|
{workersAtom.length > 0 && clustersAtom.length > 0 ? (
|
||||||
noResourceResult
|
|
||||||
) : loading ? null : (
|
|
||||||
<DashboardInner />
|
<DashboardInner />
|
||||||
|
) : loadingStatus.loading || !loadingStatus.loadend ? null : (
|
||||||
|
noResourceResult
|
||||||
)}
|
)}
|
||||||
</Spin>
|
</Spin>
|
||||||
</PageBox>
|
</PageBox>
|
||||||
|
|||||||
@@ -372,4 +372,4 @@ const AudioInput: React.FC<AudioInputProps> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(AudioInput);
|
export default AudioInput;
|
||||||
|
|||||||
@@ -48,4 +48,4 @@ const FileList: React.FC<FileListProps> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(FileList);
|
export default FileList;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { Form } from 'antd';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import React, {
|
import React, {
|
||||||
forwardRef,
|
forwardRef,
|
||||||
memo,
|
|
||||||
useCallback,
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
useId,
|
useId,
|
||||||
@@ -103,4 +102,4 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = forwardRef(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export default memo(ParamsSettings);
|
export default ParamsSettings;
|
||||||
|
|||||||
@@ -39,4 +39,4 @@ const ActiveModels: React.FC<ActiveModelsProps> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(ActiveModels);
|
export default ActiveModels;
|
||||||
|
|||||||
@@ -244,4 +244,4 @@ const ContentItem: React.FC<MessageItemProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(ContentItem);
|
export default ContentItem;
|
||||||
|
|||||||
@@ -54,4 +54,4 @@ const MessageContent: React.FC<MessageContentProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(MessageContent);
|
export default MessageContent;
|
||||||
|
|||||||
@@ -366,4 +366,4 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef((props, ref) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
export default React.memo(ModelItem);
|
export default ModelItem;
|
||||||
|
|||||||
@@ -144,4 +144,4 @@ const SystemMessage: React.FC<SystemMessageProps> = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(SystemMessage);
|
export default SystemMessage;
|
||||||
|
|||||||
@@ -81,4 +81,4 @@ const RerankMessage: React.FC<RerankMessageProps> = ({ header, dataList }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(RerankMessage);
|
export default RerankMessage;
|
||||||
|
|||||||
@@ -117,4 +117,4 @@ const UploadImg: React.FC<UploadImgProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(UploadImg);
|
export default UploadImg;
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ const Playground: React.FC = () => {
|
|||||||
<Divider
|
<Divider
|
||||||
key="divider"
|
key="divider"
|
||||||
type="vertical"
|
type="vertical"
|
||||||
style={{ height: 24, marginInline: 16 }}
|
style={{ height: 16, marginInline: 16 }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>,
|
</div>,
|
||||||
|
|||||||
Reference in New Issue
Block a user