From d4ef5a7516bc020310d6fac9cdcb20d1a1a43986 Mon Sep 17 00:00:00 2001 From: ningyv <1793599591@qq.com> Date: Sat, 15 Feb 2025 10:13:10 +0800 Subject: [PATCH] feat: feature/1.5-Data Integration --- frontend/packages/core/src/index.css | 3 + .../src/pages/aiSetting/LocalModelList.tsx | 2 +- .../core/src/pages/loadBalancing/index.tsx | 230 +++++++++--------- 3 files changed, 116 insertions(+), 119 deletions(-) diff --git a/frontend/packages/core/src/index.css b/frontend/packages/core/src/index.css index fe0145b5..c912b574 100644 --- a/frontend/packages/core/src/index.css +++ b/frontend/packages/core/src/index.css @@ -752,6 +752,9 @@ p{ .custom-steps .ant-steps-item-content { margin-top: 0 !important; } +.custom-steps .ant-steps-item-content .ant-steps-item-description { + width: 138px !important; +} .ant-modal-body .pr-PAGE_INSIDE_X{ diff --git a/frontend/packages/core/src/pages/aiSetting/LocalModelList.tsx b/frontend/packages/core/src/pages/aiSetting/LocalModelList.tsx index 7bdac68c..b30325cf 100644 --- a/frontend/packages/core/src/pages/aiSetting/LocalModelList.tsx +++ b/frontend/packages/core/src/pages/aiSetting/LocalModelList.tsx @@ -114,7 +114,7 @@ const LocalModelList: React.FC = () => { normal: { text: '正常' }, deploying: { text: '部署中', className: 'text-[#2196f3] cursor-pointer' }, error: { text: '模型异常', className: 'text-[#ff4d4f]' }, - disabled: { text: '停用', className: 'text-[#999]' }, + disabled: { text: '停用' }, deploying_error: { text: '部署失败', className: 'text-[#ff4d4f] cursor-pointer' } }) diff --git a/frontend/packages/core/src/pages/loadBalancing/index.tsx b/frontend/packages/core/src/pages/loadBalancing/index.tsx index 42f1b598..4de50ea4 100644 --- a/frontend/packages/core/src/pages/loadBalancing/index.tsx +++ b/frontend/packages/core/src/pages/loadBalancing/index.tsx @@ -14,7 +14,6 @@ import AddLoadBalancingModel from './AddModel' const LoadBalancingPage = () => { const pageListRef = useRef(null) const [searchWord, setSearchWord] = useState('') - const [columns, setColumns] = useState[]>([]) const { modal, message } = App.useApp() const [apiKeys, setApiKeys] = useState([]) const addModelRef = useRef() @@ -150,125 +149,120 @@ const LoadBalancingPage = () => { }) } - /** + /** * 设置表格列 */ - const setTableColumns = () => { - setColumns([ - { - title: '', - dataIndex: 'drag', - width: '40px' - }, - { - title: $t('优先级'), - dataIndex: 'priority', - width: 80, - ellipsis: true, - key: 'priority' - }, - { - title: $t('模型'), - dataIndex: ['provider', 'name'], - ellipsis: true, - width: 100, - key: 'provider', - render: (dom: React.ReactNode, record: LoadBalancingItems) => ( - - {record.provider?.name} / {record.model?.name} - - ) - }, - { - title: $t('类型'), - dataIndex: 'type', - width: 100, - ellipsis: true, - key: 'type', - render: (dom: React.ReactNode, record: LoadBalancingItems) => ( - {record.type === 'online' ? $t('线上模型') : $t('本地模型')} - ) - }, - { - title: $t('状态'), - dataIndex: 'state', - width: 120, - ellipsis: true, - key: 'state', - render: (dom: React.ReactNode, record: LoadBalancingItems) => ( - {statusEnum[record.state]?.text || '-'} - ) - }, - { - title: $t('Apis'), - dataIndex: 'apiCount', - ellipsis: true, - width: 80, - key: 'apiCount', - render: (dom: React.ReactNode, record: LoadBalancingItems) => ( - - - {record.apiCount || '0'} - - - ) - }, - { - title: $t('Keys'), - dataIndex: 'keyCount', - ellipsis: true, - width: 80, - key: 'keyCount', - render: (dom: React.ReactNode, record: LoadBalancingItems) => ( - - - {record.keyCount || '0'} - - - ) - }, - { - title: '', - key: 'option', - btnNums: 1, - width: 80, - fixed: 'right', - valueType: 'option', - render: (_: React.ReactNode, entity: any) => [ - handleDelete(entity.id as string)} - btnTitle={$t('删除')} - /> - ] - } - ]) - } - useEffect(() => { - setTableColumns() - }, []) + const columns: PageProColumns[] = [ + { + title: '', + dataIndex: 'drag', + width: '40px' + }, + { + title: $t('优先级'), + dataIndex: 'priority', + width: 80, + ellipsis: true, + key: 'priority' + }, + { + title: $t('模型'), + dataIndex: ['provider', 'name'], + ellipsis: true, + key: 'provider', + render: (dom: React.ReactNode, record: LoadBalancingItems) => ( + + {record.provider?.name} / {record.model?.name} + + ) + }, + { + title: $t('类型'), + dataIndex: 'type', + width: 120, + ellipsis: true, + key: 'type', + render: (dom: React.ReactNode, record: LoadBalancingItems) => ( + {record.type === 'online' ? $t('线上模型') : $t('本地模型')} + ) + }, + { + title: $t('状态'), + dataIndex: 'state', + width: 80, + ellipsis: true, + key: 'state', + render: (dom: React.ReactNode, record: LoadBalancingItems) => ( + {statusEnum[record.state]?.text || '-'} + ) + }, + { + title: $t('Apis'), + dataIndex: 'apiCount', + ellipsis: true, + width: 80, + key: 'apiCount', + render: (dom: React.ReactNode, record: LoadBalancingItems) => ( + + + {record.apiCount || '0'} + + + ) + }, + { + title: $t('Keys'), + dataIndex: 'keyCount', + ellipsis: true, + width: 80, + key: 'keyCount', + render: (dom: React.ReactNode, record: LoadBalancingItems) => ( + + + {record.keyCount || '0'} + + + ) + }, + { + title: '', + key: 'option', + btnNums: 1, + width: 50, + fixed: 'right', + valueType: 'option', + render: (_: React.ReactNode, entity: any) => [ + handleDelete(entity.id as string)} + btnTitle={$t('删除')} + /> + ] + } + ] + return ( <>