diff --git a/src/components/label-selector/index.tsx b/src/components/label-selector/index.tsx index 99db8ec5..441402b4 100644 --- a/src/components/label-selector/index.tsx +++ b/src/components/label-selector/index.tsx @@ -44,6 +44,7 @@ const LabelSelector: React.FC = ({ [setLabelList] ); const handleLabelsChange = (data: Record) => { + console.log('handleLabelsChange', data); setLabelsData(data); onChange?.(data); }; @@ -52,10 +53,9 @@ const LabelSelector: React.FC = ({ e: React.ClipboardEvent, index: number ) => { - e.preventDefault(); - const clipboardText = e.clipboardData.getData('text'); - if (!clipboardText) return; + if (!clipboardText || clipboardText.indexOf('=') === -1) return; + e.preventDefault(); const lines = clipboardText .split(/\r?\n/) diff --git a/src/layouts/runtime.tsx b/src/layouts/runtime.tsx index 549ec942..06dd26c2 100644 --- a/src/layouts/runtime.tsx +++ b/src/layouts/runtime.tsx @@ -26,7 +26,6 @@ export function patchRoutes({ routes, initialState }) { export function renderMenuIcon(icon: string) { const upperIcon = formatIcon(icon); - console.log('upperIcon', icon, upperIcon); if (icons[upperIcon] || icons[upperIcon + 'Outlined']) { return React.createElement( icons[upperIcon] || icons[upperIcon + 'Outlined'] diff --git a/src/pages/llmodels/config/button-actions.ts b/src/pages/llmodels/config/button-actions.ts index 9f7aa3a6..fcdc7c48 100644 --- a/src/pages/llmodels/config/button-actions.ts +++ b/src/pages/llmodels/config/button-actions.ts @@ -3,7 +3,8 @@ import HotKeys from '@/config/hotkeys'; import { DeleteOutlined, EditOutlined, - ExperimentOutlined + ExperimentOutlined, + ThunderboltOutlined } from '@ant-design/icons'; import _ from 'lodash'; import React from 'react'; @@ -13,6 +14,7 @@ const icons = { EditOutlined: React.createElement(EditOutlined), ExperimentOutlined: React.createElement(ExperimentOutlined), DeleteOutlined: React.createElement(DeleteOutlined), + ThunderboltOutlined: React.createElement(ThunderboltOutlined), Stop: React.createElement(IconFont, { type: 'icon-stop1' }), Play: React.createElement(IconFont, { type: 'icon-outline-play' }), Catalog: React.createElement(IconFont, { type: 'icon-catalog' }), @@ -184,6 +186,22 @@ export const setModelActionList = (record: any) => { }); }; +export const modelFileActions = [ + { + label: 'common.button.deploy', + key: 'deploy', + icon: icons.ThunderboltOutlined + }, + { + label: 'common.button.delete', + key: 'delete', + props: { + danger: true + }, + icon: icons.DeleteOutlined + } +]; + export const categoryToPathMap: Record = { [modelCategoriesMap.llm]: '/playground/chat', [modelCategoriesMap.image]: '/playground/text-to-image', diff --git a/src/pages/resources/components/model-files.tsx b/src/pages/resources/components/model-files.tsx index c62ad0bd..51921ccd 100644 --- a/src/pages/resources/components/model-files.tsx +++ b/src/pages/resources/components/model-files.tsx @@ -7,64 +7,22 @@ import StatusTag from '@/components/status-tag'; import useTableFetch from '@/hooks/use-table-fetch'; import { modelSourceMap } from '@/pages/llmodels/config'; import { + generateSource, modalConfig, + modelFileActions, onLineSourceOptions } from '@/pages/llmodels/config/button-actions'; import DownloadModal from '@/pages/llmodels/download'; -import { - DeleteOutlined, - DownOutlined, - SyncOutlined, - ThunderboltOutlined -} from '@ant-design/icons'; +import { DeleteOutlined, DownOutlined, SyncOutlined } from '@ant-design/icons'; import { useIntl } from '@umijs/max'; -import React, { - Button, - ConfigProvider, - Empty, - Input, - Space, - Table -} from 'antd'; +import { Button, ConfigProvider, Empty, Input, Space, Table } from 'antd'; import dayjs from 'dayjs'; import { useState } from 'react'; import { deleteWorker, queryWorkersList } from '../apis'; import { WorkerStatusMapValue, status } from '../config'; import { ModelFile as ListItem } from '../config/types'; -const ActionList = [ - { - label: 'common.button.deploy', - key: 'deploy', - icon: - }, - { - label: 'common.button.delete', - key: 'delete', - props: { - danger: true - }, - icon: - } -]; - -const generateSource = (record: ListItem) => { - if (record.source === modelSourceMap.modelscope_value) { - return `${modelSourceMap.modelScope}/${record.model_scope_model_id}`; - } - if (record.source === modelSourceMap.huggingface_value) { - return `${modelSourceMap.huggingface}/${record.huggingface_repo_id}`; - } - if (record.source === modelSourceMap.local_path_value) { - return `${record.local_path}`; - } - if (record.source === modelSourceMap.ollama_library_value) { - return `${modelSourceMap.ollama_library}/${record.ollama_library_model_name}`; - } - return ''; -}; - -const ModelFiles: React.FC = () => { +const ModelFiles = () => { const { dataSource, rowSelection, @@ -208,7 +166,7 @@ const ModelFiles: React.FC = () => { dataIndex: 'operation', render: (text: string, record: ListItem) => ( handleSelect(val, record)} > )