feat: add cluster detail page
This commit is contained in:
@@ -28,7 +28,8 @@ const icons = {
|
|||||||
ModelScope: React.createElement(IconFont, { type: 'icon-tu2' }),
|
ModelScope: React.createElement(IconFont, { type: 'icon-tu2' }),
|
||||||
LocalPath: React.createElement(IconFont, { type: 'icon-hard-disk' }),
|
LocalPath: React.createElement(IconFont, { type: 'icon-hard-disk' }),
|
||||||
Launch: React.createElement(IconFont, { type: 'icon-rocket-launch' }),
|
Launch: React.createElement(IconFont, { type: 'icon-rocket-launch' }),
|
||||||
Deployment: React.createElement(IconFont, { type: 'icon-rocket-launch1' })
|
Deployment: React.createElement(IconFont, { type: 'icon-rocket-launch1' }),
|
||||||
|
Docker: React.createElement(IconFont, { type: 'icon-docker' })
|
||||||
};
|
};
|
||||||
|
|
||||||
export default icons;
|
export default icons;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
|
|||||||
// import './iconfont/iconfont.js';
|
// import './iconfont/iconfont.js';
|
||||||
|
|
||||||
const IconFont = createFromIconfontCN({
|
const IconFont = createFromIconfontCN({
|
||||||
scriptUrl: '//at.alicdn.com/t/c/font_4613488_pouhrqmodr9.js'
|
scriptUrl: '//at.alicdn.com/t/c/font_4613488_arejw0wk0kd.js'
|
||||||
});
|
});
|
||||||
|
|
||||||
export default IconFont;
|
export default IconFont;
|
||||||
|
|||||||
@@ -1,15 +1,40 @@
|
|||||||
import { useEscHint } from '@/hooks/use-esc-hint';
|
import { useEscHint } from '@/hooks/use-esc-hint';
|
||||||
import { Drawer, type DrawerProps } from 'antd';
|
import { CloseOutlined } from '@ant-design/icons';
|
||||||
|
import { Button, Drawer, type DrawerProps } from 'antd';
|
||||||
|
|
||||||
const ScrollerModal = (props: DrawerProps) => {
|
const ScrollerModal = (props: DrawerProps) => {
|
||||||
|
const { title, closable = true, ...restProps } = props;
|
||||||
const { EscHint } = useEscHint({
|
const { EscHint } = useEscHint({
|
||||||
enabled: !props.keyboard && props.open
|
enabled: !props.keyboard && props.open
|
||||||
});
|
});
|
||||||
|
const handleCancel = (e: React.MouseEvent<HTMLElement>) => {
|
||||||
|
props.onClose?.(e);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Drawer {...props}>
|
<Drawer
|
||||||
{props.children}
|
{...restProps}
|
||||||
|
closable={false}
|
||||||
|
title={
|
||||||
|
<div className="flex-between flex-center">
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
color: 'var(--ant-color-text)',
|
||||||
|
fontWeight: 'var(--font-weight-medium)',
|
||||||
|
fontSize: 'var(--font-size-middle)'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{title}
|
||||||
|
</span>
|
||||||
|
{closable && (
|
||||||
|
<Button type="text" size="small" onClick={handleCancel}>
|
||||||
|
<CloseOutlined></CloseOutlined>
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{restProps.children}
|
||||||
{EscHint}
|
{EscHint}
|
||||||
</Drawer>
|
</Drawer>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -15,16 +15,16 @@ import {
|
|||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { PageContainer } from '@ant-design/pro-components';
|
import { PageContainer } from '@ant-design/pro-components';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Empty, Table, message } from 'antd';
|
import { Table, message } from 'antd';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import styled from 'styled-components';
|
|
||||||
import {
|
import {
|
||||||
createCredential,
|
createCluster,
|
||||||
deleteCredential,
|
deleteCluster,
|
||||||
queryCredentialList,
|
queryClusterList,
|
||||||
updateCredential
|
updateCluster
|
||||||
} from './apis';
|
} from './apis';
|
||||||
import AddCluster from './components/add-cluster';
|
import AddCluster from './components/add-cluster';
|
||||||
|
import ClusterDetailModal from './components/cluster-detail-modal';
|
||||||
import ClusterItem from './components/cluster-item';
|
import ClusterItem from './components/cluster-item';
|
||||||
import { ClusterDataList } from './config';
|
import { ClusterDataList } from './config';
|
||||||
import {
|
import {
|
||||||
@@ -57,39 +57,6 @@ const addActions = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const WorkerWrapper = styled.div`
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 4px;
|
|
||||||
align-items: flex-start;
|
|
||||||
.worker {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 5px;
|
|
||||||
.value {
|
|
||||||
line-height: 1em;
|
|
||||||
color: var(--ant-color-text-secondary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.dot {
|
|
||||||
display: inline-block;
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 4px;
|
|
||||||
&.ready {
|
|
||||||
background-color: var(--ant-color-success);
|
|
||||||
}
|
|
||||||
&.error {
|
|
||||||
background-color: var(--ant-color-error);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.transition {
|
|
||||||
background-color: var(--ant-blue-5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const ActionList = [
|
const ActionList = [
|
||||||
{
|
{
|
||||||
key: 'edit',
|
key: 'edit',
|
||||||
@@ -139,13 +106,23 @@ const Credentials: React.FC = () => {
|
|||||||
handleSearch,
|
handleSearch,
|
||||||
handleNameChange
|
handleNameChange
|
||||||
} = useTableFetch<ListItem>({
|
} = useTableFetch<ListItem>({
|
||||||
fetchAPI: queryCredentialList,
|
fetchAPI: queryClusterList,
|
||||||
deleteAPI: deleteCredential,
|
deleteAPI: deleteCluster,
|
||||||
contentForDelete: 'users.table.user'
|
contentForDelete: 'users.table.user'
|
||||||
});
|
});
|
||||||
|
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [openAddWorker, setOpenAddWorker] = useState({
|
const [openClusterDetail, setOpenClusterDetail] = useState<{
|
||||||
|
open: boolean;
|
||||||
|
id: number;
|
||||||
|
}>({
|
||||||
|
open: false,
|
||||||
|
id: 0
|
||||||
|
});
|
||||||
|
const [openAddWorker, setOpenAddWorker] = useState<{
|
||||||
|
open: boolean;
|
||||||
|
token: string;
|
||||||
|
}>({
|
||||||
open: false,
|
open: false,
|
||||||
token: ''
|
token: ''
|
||||||
});
|
});
|
||||||
@@ -202,14 +179,12 @@ const Credentials: React.FC = () => {
|
|||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
if (action === PageAction.EDIT) {
|
if (action === PageAction.EDIT) {
|
||||||
await updateCredential({
|
await updateCluster({
|
||||||
data: {
|
data: params,
|
||||||
...params,
|
id: currentData!.id
|
||||||
id: currentData?.id
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await createCredential({ data: params });
|
await createCluster({ data: params });
|
||||||
}
|
}
|
||||||
fetchData();
|
fetchData();
|
||||||
setOpenAddModal(false);
|
setOpenAddModal(false);
|
||||||
@@ -244,6 +219,11 @@ const Credentials: React.FC = () => {
|
|||||||
setCurrentData(row);
|
setCurrentData(row);
|
||||||
} else if (val === 'addPool') {
|
} else if (val === 'addPool') {
|
||||||
handleAddPool(row.provider);
|
handleAddPool(row.provider);
|
||||||
|
} else if (val === 'details') {
|
||||||
|
setOpenClusterDetail({
|
||||||
|
open: true,
|
||||||
|
id: row.id
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -251,18 +231,6 @@ const Credentials: React.FC = () => {
|
|||||||
return <ClusterItem data={item} onSelect={handleSelect}></ClusterItem>;
|
return <ClusterItem data={item} onSelect={handleSelect}></ClusterItem>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderEmpty = (type?: string) => {
|
|
||||||
if (type !== 'Table') return;
|
|
||||||
if (
|
|
||||||
!dataSource.loading &&
|
|
||||||
dataSource.loadend &&
|
|
||||||
!dataSource.dataList.length
|
|
||||||
) {
|
|
||||||
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}></Empty>;
|
|
||||||
}
|
|
||||||
return <div></div>;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageContainer
|
<PageContainer
|
||||||
@@ -318,6 +286,11 @@ const Credentials: React.FC = () => {
|
|||||||
onCancel={() => setOpenAddWorker({ open: false, token: '' })}
|
onCancel={() => setOpenAddWorker({ open: false, token: '' })}
|
||||||
token={openAddWorker.token}
|
token={openAddWorker.token}
|
||||||
></AddWorker>
|
></AddWorker>
|
||||||
|
<ClusterDetailModal
|
||||||
|
open={openClusterDetail.open}
|
||||||
|
id={openClusterDetail.id}
|
||||||
|
onClose={() => setOpenClusterDetail({ open: false, id: 0 })}
|
||||||
|
></ClusterDetailModal>
|
||||||
<DeleteModal ref={modalRef}></DeleteModal>
|
<DeleteModal ref={modalRef}></DeleteModal>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-3
@@ -16,9 +16,7 @@ const SubTitle = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
interface ClusterDetailProps {
|
interface ClusterDetailProps {
|
||||||
provider: string;
|
|
||||||
data: ClusterListItem;
|
data: ClusterListItem;
|
||||||
show: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const gaugeConfig = {
|
const gaugeConfig = {
|
||||||
@@ -41,8 +39,9 @@ const gaugeConfig = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const ClusterDetail: React.FC<ClusterDetailProps> = ({ data, show }) => {
|
const ClusterDetail: React.FC<ClusterDetailProps> = ({ data }) => {
|
||||||
const chartHeight = 160;
|
const chartHeight = 160;
|
||||||
|
const [show, setShow] = React.useState(false);
|
||||||
const [addPoolStatus, setAddPoolStatus] = React.useState({
|
const [addPoolStatus, setAddPoolStatus] = React.useState({
|
||||||
open: false,
|
open: false,
|
||||||
action: PageAction.CREATE,
|
action: PageAction.CREATE,
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import GSDrawer from '@/components/scroller-modal/gs-drawer';
|
||||||
|
import React from 'react';
|
||||||
|
import ClusterDetailContent from './cluster-detail-content';
|
||||||
|
|
||||||
|
interface ClusterDetailModalProps {
|
||||||
|
open: boolean;
|
||||||
|
onClose?: () => void;
|
||||||
|
id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ClusterDetailModal: React.FC<ClusterDetailModalProps> = ({
|
||||||
|
open,
|
||||||
|
onClose,
|
||||||
|
id: clusterId
|
||||||
|
}) => {
|
||||||
|
const [data, setData] = React.useState<any>({
|
||||||
|
id: 1,
|
||||||
|
name: 'kubernetes-cluster',
|
||||||
|
provider: 'kubernetes',
|
||||||
|
clusterType: 'Kubernetes',
|
||||||
|
workers: 2,
|
||||||
|
gpus: 4,
|
||||||
|
status: 'ready',
|
||||||
|
deployments: 1
|
||||||
|
});
|
||||||
|
const handleOnClose = () => {
|
||||||
|
onClose?.();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<GSDrawer
|
||||||
|
width={800}
|
||||||
|
title={`Cluster Detail - ${clusterId}`}
|
||||||
|
open={open}
|
||||||
|
onClose={handleOnClose}
|
||||||
|
>
|
||||||
|
<ClusterDetailContent data={data} />
|
||||||
|
</GSDrawer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ClusterDetailModal;
|
||||||
@@ -31,9 +31,9 @@ const actionItems = [
|
|||||||
icon: <EditOutlined />
|
icon: <EditOutlined />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'view',
|
key: 'details',
|
||||||
label: 'common.button.view',
|
label: 'common.button.view',
|
||||||
icon: <EditOutlined />
|
icon: <IconFont type="icon-detail-info" className="font-size-16" />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'add_worker',
|
key: 'add_worker',
|
||||||
|
|||||||
@@ -34,7 +34,10 @@ import {
|
|||||||
updateCredential
|
updateCredential
|
||||||
} from './apis';
|
} from './apis';
|
||||||
import AddModal from './components/add-credential';
|
import AddModal from './components/add-credential';
|
||||||
import { FormData, ListItem } from './config/types';
|
import {
|
||||||
|
CredentialFormData as FormData,
|
||||||
|
CredentialListItem as ListItem
|
||||||
|
} from './config/types';
|
||||||
const { Column } = Table;
|
const { Column } = Table;
|
||||||
|
|
||||||
const ActionList = [
|
const ActionList = [
|
||||||
@@ -127,9 +130,9 @@ const Credentials: React.FC = () => {
|
|||||||
if (openModalStatus.action === PageAction.EDIT) {
|
if (openModalStatus.action === PageAction.EDIT) {
|
||||||
await updateCredential({
|
await updateCredential({
|
||||||
data: {
|
data: {
|
||||||
...params,
|
...params
|
||||||
id: currentData?.id
|
},
|
||||||
}
|
id: currentData!.id
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await createCredential({ data: params });
|
await createCredential({ data: params });
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import ModalFooter from '@/components/modal-footer';
|
|||||||
import GSDrawer from '@/components/scroller-modal/gs-drawer';
|
import GSDrawer from '@/components/scroller-modal/gs-drawer';
|
||||||
import { PageActionType } from '@/config/types';
|
import { PageActionType } from '@/config/types';
|
||||||
import useDeferredRequest from '@/hooks/use-deferred-request';
|
import useDeferredRequest from '@/hooks/use-deferred-request';
|
||||||
import { CloseOutlined } from '@ant-design/icons';
|
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
@@ -500,14 +499,7 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GSDrawer
|
<GSDrawer
|
||||||
title={
|
title={title}
|
||||||
<div className="flex-between flex-center">
|
|
||||||
<span>{title}</span>
|
|
||||||
<Button type="text" size="small" onClick={handleCancel}>
|
|
||||||
<CloseOutlined></CloseOutlined>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
open={open}
|
open={open}
|
||||||
onClose={handleCancel}
|
onClose={handleCancel}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
|
|||||||
@@ -193,7 +193,6 @@ export const modelFileActions = [
|
|||||||
|
|
||||||
export const categoryToPathMap: Record<string, string> = {
|
export const categoryToPathMap: Record<string, string> = {
|
||||||
[modelCategoriesMap.llm]: '/playground/chat',
|
[modelCategoriesMap.llm]: '/playground/chat',
|
||||||
[modelCategoriesMap.image]: '/playground/text-to-image',
|
|
||||||
[modelCategoriesMap.text_to_speech]: '/playground/speech?type=tts',
|
[modelCategoriesMap.text_to_speech]: '/playground/speech?type=tts',
|
||||||
[modelCategoriesMap.speech_to_text]: '/playground/speech?type=stt',
|
[modelCategoriesMap.speech_to_text]: '/playground/speech?type=stt',
|
||||||
[modelCategoriesMap.reranker]: '/playground/rerank',
|
[modelCategoriesMap.reranker]: '/playground/rerank',
|
||||||
|
|||||||
@@ -330,14 +330,17 @@ export const modelCategoriesMap = {
|
|||||||
llm: 'llm'
|
llm: 'llm'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const categoryOptions = [
|
||||||
|
{ label: 'LLM', value: modelCategoriesMap.llm },
|
||||||
|
{ label: 'Embedding', value: modelCategoriesMap.embedding },
|
||||||
|
{ label: 'Reranker', value: modelCategoriesMap.reranker },
|
||||||
|
{ label: 'Text-to-Speech', value: modelCategoriesMap.text_to_speech },
|
||||||
|
{ label: 'Speech-to-Text', value: modelCategoriesMap.speech_to_text }
|
||||||
|
];
|
||||||
|
|
||||||
export const modelCategories = [
|
export const modelCategories = [
|
||||||
{ label: 'common.options.auto', value: null, locale: true },
|
{ label: 'common.options.auto', value: null, locale: true },
|
||||||
{ label: 'LLM', value: modelCategoriesMap.llm },
|
...categoryOptions
|
||||||
{ label: 'Image', value: modelCategoriesMap.image },
|
|
||||||
{ label: 'Text-to-Speech', value: modelCategoriesMap.text_to_speech },
|
|
||||||
{ label: 'Speech-to-Text', value: modelCategoriesMap.speech_to_text },
|
|
||||||
{ label: 'Embedding', value: modelCategoriesMap.embedding },
|
|
||||||
{ label: 'Reranker', value: modelCategoriesMap.reranker }
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const sourceRepoConfig = {
|
export const sourceRepoConfig = {
|
||||||
|
|||||||
@@ -86,8 +86,6 @@ export interface DistributedServerItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DistributedServers {
|
export interface DistributedServers {
|
||||||
rpc_servers: DistributedServerItem[];
|
|
||||||
ray_actors: DistributedServerItem[];
|
|
||||||
subordinate_workers: DistributedServerItem[];
|
subordinate_workers: DistributedServerItem[];
|
||||||
}
|
}
|
||||||
export interface ModelInstanceListItem {
|
export interface ModelInstanceListItem {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import ModalFooter from '@/components/modal-footer';
|
import ModalFooter from '@/components/modal-footer';
|
||||||
import GSDrawer from '@/components/scroller-modal/gs-drawer';
|
import GSDrawer from '@/components/scroller-modal/gs-drawer';
|
||||||
import { CloseOutlined } from '@ant-design/icons';
|
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
import { Button } from 'antd';
|
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import ColumnWrapper from '../components/column-wrapper';
|
import ColumnWrapper from '../components/column-wrapper';
|
||||||
@@ -127,22 +125,7 @@ const DownloadModel: React.FC<AddModalProps> = (props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GSDrawer
|
<GSDrawer
|
||||||
title={
|
title={title}
|
||||||
<div className="flex-between flex-center">
|
|
||||||
<span
|
|
||||||
style={{
|
|
||||||
color: 'var(--ant-color-text)',
|
|
||||||
fontWeight: 'var(--font-weight-medium)',
|
|
||||||
fontSize: 'var(--font-size-middle)'
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{title}
|
|
||||||
</span>
|
|
||||||
<Button type="text" size="small" onClick={handleCancel}>
|
|
||||||
<CloseOutlined></CloseOutlined>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
open={open}
|
open={open}
|
||||||
onClose={handleCancel}
|
onClose={handleCancel}
|
||||||
destroyOnClose={true}
|
destroyOnClose={true}
|
||||||
|
|||||||
@@ -5,19 +5,28 @@ import CardSkeleton from '@/components/templates/card-skelton';
|
|||||||
import useTableFetch from '@/hooks/use-table-fetch';
|
import useTableFetch from '@/hooks/use-table-fetch';
|
||||||
import { SyncOutlined } from '@ant-design/icons';
|
import { SyncOutlined } from '@ant-design/icons';
|
||||||
import { PageContainer } from '@ant-design/pro-components';
|
import { PageContainer } from '@ant-design/pro-components';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl, useNavigate } from '@umijs/max';
|
||||||
import { Button, Input, Select, Space } from 'antd';
|
import { Button, Input, Select, Space } from 'antd';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { MODELS_API, queryModelsList } from './apis';
|
import { MODELS_API, queryModelsList } from './apis';
|
||||||
import ModelItem from './components/model-item';
|
import ModelItem from './components/model-item';
|
||||||
|
import { categoryOptions, modelCategoriesMap } from './config';
|
||||||
|
import { categoryToPathMap } from './config/button-actions';
|
||||||
|
|
||||||
const UserModels: React.FC = () => {
|
const UserModels: React.FC = () => {
|
||||||
const { dataSource, queryParams, fetchData, handleSearch, handleNameChange } =
|
const navigate = useNavigate();
|
||||||
useTableFetch<any>({
|
const {
|
||||||
fetchAPI: queryModelsList,
|
dataSource,
|
||||||
API: MODELS_API,
|
queryParams,
|
||||||
watch: false
|
fetchData,
|
||||||
});
|
handleSearch,
|
||||||
|
handleQueryChange,
|
||||||
|
handleNameChange
|
||||||
|
} = useTableFetch<any>({
|
||||||
|
fetchAPI: queryModelsList,
|
||||||
|
API: MODELS_API,
|
||||||
|
watch: false
|
||||||
|
});
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
const loadMore = () => {
|
const loadMore = () => {
|
||||||
@@ -27,8 +36,30 @@ const UserModels: React.FC = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleCategoryChange = (value: string) => {
|
||||||
|
handleQueryChange({
|
||||||
|
categories: value
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const handleOnClick = (model: any) => {
|
const handleOnClick = (model: any) => {
|
||||||
console.log('Deploying model:', model);
|
for (const [category, path] of Object.entries(categoryToPathMap)) {
|
||||||
|
if (
|
||||||
|
model.categories?.includes(category) &&
|
||||||
|
[
|
||||||
|
modelCategoriesMap.text_to_speech,
|
||||||
|
modelCategoriesMap.speech_to_text
|
||||||
|
].includes(category)
|
||||||
|
) {
|
||||||
|
navigate(`${path}&model=${model.name}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (model.categories?.includes(category)) {
|
||||||
|
navigate(`${path}?model=${model.name}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
navigate(`/playground/chat?model=${model.name}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderCard = (data: any) => {
|
const renderCard = (data: any) => {
|
||||||
@@ -72,7 +103,8 @@ const UserModels: React.FC = () => {
|
|||||||
style={{ width: 180 }}
|
style={{ width: 180 }}
|
||||||
size="large"
|
size="large"
|
||||||
maxTagCount={1}
|
maxTagCount={1}
|
||||||
options={[]}
|
options={categoryOptions}
|
||||||
|
onChange={handleCategoryChange}
|
||||||
></Select>
|
></Select>
|
||||||
<Button
|
<Button
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
Reference in New Issue
Block a user