From e1ada8f53d4f40e723e6e3f254c0e7e85157ef65 Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 12 Sep 2024 19:17:54 +0800 Subject: [PATCH] fix: rpc server field error --- config/config.ts | 2 +- src/components/simple-table/index.tsx | 9 ++++++-- .../llmodels/components/instance-item.tsx | 19 +++++++-------- src/pages/llmodels/components/table-list.tsx | 23 +++++++++++-------- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/config/config.ts b/config/config.ts index 36546891..9dbc3ccd 100644 --- a/config/config.ts +++ b/config/config.ts @@ -14,7 +14,7 @@ const isProduction = env === 'production'; const t = Date.now(); export default defineConfig({ proxy: { - ...proxy() + ...proxy('http://192.168.50.166:8080') }, history: { type: 'hash' diff --git a/src/components/simple-table/index.tsx b/src/components/simple-table/index.tsx index 078cd905..de375164 100644 --- a/src/components/simple-table/index.tsx +++ b/src/components/simple-table/index.tsx @@ -10,9 +10,10 @@ interface SimpleTableProps { columns: any[]; dataSource: any[]; bordered?: boolean; + rowKey?: string; } const SimpleTabel: React.FC = (props) => { - const { columns, dataSource, bordered = true } = props; + const { columns, dataSource, rowKey, bordered = true } = props; return ( = (props) => { {dataSource.map((item: any, index: number) => { return ( - + ); })} diff --git a/src/pages/llmodels/components/instance-item.tsx b/src/pages/llmodels/components/instance-item.tsx index c9f77158..393f15d8 100644 --- a/src/pages/llmodels/components/instance-item.tsx +++ b/src/pages/llmodels/components/instance-item.tsx @@ -102,24 +102,24 @@ const InstanceItem: React.FC = ({ ); }; - const renderDistributionInfo = (item: ModelInstanceListItem) => { - const rpcServerList = item.distributed_servers?.rpc_servers || []; + const renderDistributionInfo = (row: ModelInstanceListItem) => { + const rpcServerList = row.distributed_servers?.rpc_servers || []; const list = _.map(rpcServerList, (item: any) => { const data = _.find(workerList, { id: item.worker_id }); return { - woker_name: data?.name, - work_ip: data.ip, - port: item.port, + worker_name: data?.name, + worker_ip: data?.ip, + port: data?.port, gpu_index: item.gpu_index }; }); const mainWorker = [ { - worker_name: `${item.worker_name}`, - worker_ip: `${item.worker_ip}`, - port: item.port, - gpu_index: `${item.gpu_indexes} (main)` + worker_name: `${row.worker_name}`, + worker_ip: `${row.worker_ip}`, + port: row.port, + gpu_index: `${row.gpu_indexes} (main)` } ]; @@ -135,6 +135,7 @@ const InstanceItem: React.FC = ({ ); }; + return ( {_.map(list, (item: ModelInstanceListItem, index: number) => { diff --git a/src/pages/llmodels/components/table-list.tsx b/src/pages/llmodels/components/table-list.tsx index 281c6c63..40e5d789 100644 --- a/src/pages/llmodels/components/table-list.tsx +++ b/src/pages/llmodels/components/table-list.tsx @@ -361,16 +361,19 @@ const Models: React.FC = ({ [] ); - const renderChildren = useCallback((list: any) => { - return ( - - ); - }, []); + const renderChildren = useCallback( + (list: any) => { + return ( + + ); + }, + [workerList] + ); const handleCloseViewCode = useCallback(() => { setEmbeddingParams({