fix: can not paste a text in env vars input box
This commit is contained in:
@@ -44,6 +44,7 @@ const LabelSelector: React.FC<LabelSelectorProps> = ({
|
||||
[setLabelList]
|
||||
);
|
||||
const handleLabelsChange = (data: Record<string, any>) => {
|
||||
console.log('handleLabelsChange', data);
|
||||
setLabelsData(data);
|
||||
onChange?.(data);
|
||||
};
|
||||
@@ -52,10 +53,9 @@ const LabelSelector: React.FC<LabelSelectorProps> = ({
|
||||
e: React.ClipboardEvent<HTMLTextAreaElement>,
|
||||
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/)
|
||||
|
||||
@@ -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']
|
||||
|
||||
@@ -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<string, string> = {
|
||||
[modelCategoriesMap.llm]: '/playground/chat',
|
||||
[modelCategoriesMap.image]: '/playground/text-to-image',
|
||||
|
||||
@@ -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: <ThunderboltOutlined />
|
||||
},
|
||||
{
|
||||
label: 'common.button.delete',
|
||||
key: 'delete',
|
||||
props: {
|
||||
danger: true
|
||||
},
|
||||
icon: <DeleteOutlined />
|
||||
}
|
||||
];
|
||||
|
||||
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) => (
|
||||
<DropdownButtons
|
||||
items={ActionList}
|
||||
items={modelFileActions}
|
||||
onSelect={(val) => handleSelect(val, record)}
|
||||
></DropdownButtons>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user