chore: set source as local_path deploy from model files
This commit is contained in:
@@ -2,7 +2,7 @@ import { createFromIconfontCN } from '@ant-design/icons';
|
||||
// import './iconfont/iconfont.js';
|
||||
|
||||
const IconFont = createFromIconfontCN({
|
||||
scriptUrl: '//at.alicdn.com/t/c/font_4613488_s7szfcrvqw.js'
|
||||
scriptUrl: '//at.alicdn.com/t/c/font_4613488_ivr9tor4zfm.js'
|
||||
});
|
||||
|
||||
export default IconFont;
|
||||
|
||||
@@ -68,5 +68,5 @@ export default {
|
||||
'resources.modelfiles.storagePath.holder':
|
||||
'Waiting for download to complete...',
|
||||
'resources.filter.worker': 'Filter by Worker',
|
||||
'resources.filter.file': 'Filter by File'
|
||||
'resources.filter.source': 'Filter by Source'
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ export default {
|
||||
'resources.modelfiles.storagePath.holder':
|
||||
'Waiting for download to complete...',
|
||||
'resources.filter.worker': 'Filter by Worker',
|
||||
'resources.filter.file': 'Filter by File'
|
||||
'resources.filter.source': 'Filter by Source'
|
||||
};
|
||||
|
||||
// ========== To-Do: Translate Keys (Remove After Translation) ==========
|
||||
@@ -82,5 +82,5 @@ export default {
|
||||
//8. 'resources.modelfiles.form.localdir.tips',
|
||||
//9. 'resources.modelfiles.storagePath.holder',
|
||||
//10. 'resources.filter.worker',
|
||||
//11. 'resources.filter.file',
|
||||
//11. 'resources.filter.source',
|
||||
// ========== End of To-Do List ==========
|
||||
|
||||
@@ -66,5 +66,5 @@ export default {
|
||||
'resources.modelfiles.retry.download': '重新下载',
|
||||
'resources.modelfiles.storagePath.holder': '等待下载完成...',
|
||||
'resources.filter.worker': '按 worker 筛选',
|
||||
'resources.filter.file': '按文件筛选'
|
||||
'resources.filter.source': '按来源筛选'
|
||||
};
|
||||
|
||||
@@ -236,6 +236,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
]}
|
||||
>
|
||||
<SealAutoComplete
|
||||
allowClear
|
||||
filterOption
|
||||
defaultActiveFirstOption
|
||||
disabled={false}
|
||||
@@ -280,6 +281,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
]}
|
||||
>
|
||||
<SealAutoComplete
|
||||
allowClear
|
||||
required
|
||||
filterOption
|
||||
defaultActiveFirstOption
|
||||
|
||||
@@ -23,7 +23,8 @@ const icons = {
|
||||
HF: React.createElement(IconFont, { type: 'icon-huggingface' }),
|
||||
Ollama: React.createElement(IconFont, { type: 'icon-ollama' }),
|
||||
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' })
|
||||
};
|
||||
|
||||
export const modalConfig: Record<
|
||||
@@ -192,7 +193,7 @@ export const modelFileActions = [
|
||||
{
|
||||
label: 'common.button.deploy',
|
||||
key: 'deploy',
|
||||
icon: icons.ThunderboltOutlined
|
||||
icon: icons.Launch
|
||||
},
|
||||
{
|
||||
label: 'resources.modelfiles.retry.download',
|
||||
|
||||
@@ -2,12 +2,19 @@ import IconFont from '@/components/icon-font';
|
||||
import SealAutoComplete from '@/components/seal-form/auto-complete';
|
||||
import SealInput from '@/components/seal-form/seal-input';
|
||||
import SealSelect from '@/components/seal-form/seal-select';
|
||||
import TooltipList from '@/components/tooltip-list';
|
||||
import useAppUtils from '@/hooks/use-app-utils';
|
||||
import { ModelFileFormData as FormData } from '@/pages/resources/config/types';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Form, Typography } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
||||
import { modelSourceMap, ollamaModelOptions, sourceOptions } from '../config';
|
||||
import {
|
||||
localPathTipsList,
|
||||
modelSourceMap,
|
||||
ollamaModelOptions,
|
||||
sourceOptions
|
||||
} from '../config';
|
||||
|
||||
interface TargetFormProps {
|
||||
ref?: any;
|
||||
@@ -27,7 +34,8 @@ const TargetForm: React.FC<TargetFormProps> = forwardRef((props, ref) => {
|
||||
}));
|
||||
|
||||
const handleOk = (values: any) => {
|
||||
onOk(values);
|
||||
const data = _.pickBy(values, (val: string) => val);
|
||||
onOk(data);
|
||||
};
|
||||
|
||||
const renderLocalPathFields = () => {
|
||||
@@ -46,6 +54,7 @@ const TargetForm: React.FC<TargetFormProps> = forwardRef((props, ref) => {
|
||||
<SealInput.Input
|
||||
required
|
||||
label={intl.formatMessage({ id: 'models.form.filePath' })}
|
||||
description={<TooltipList list={localPathTipsList}></TooltipList>}
|
||||
></SealInput.Input>
|
||||
</Form.Item>
|
||||
</>
|
||||
@@ -66,6 +75,7 @@ const TargetForm: React.FC<TargetFormProps> = forwardRef((props, ref) => {
|
||||
]}
|
||||
>
|
||||
<SealAutoComplete
|
||||
allowClear
|
||||
filterOption
|
||||
defaultActiveFirstOption
|
||||
disabled={false}
|
||||
|
||||
@@ -227,14 +227,13 @@ const ModelFiles = () => {
|
||||
const result = setSourceRepoConfigValue(record.source, record);
|
||||
|
||||
return {
|
||||
...result.values,
|
||||
source: modelSourceMap.local_path_value,
|
||||
local_path: record.resolved_paths?.[0],
|
||||
worker_selector: targetWorker
|
||||
? {
|
||||
'worker-name': targetWorker
|
||||
}
|
||||
: {},
|
||||
source: record.source,
|
||||
local_path: record.local_path,
|
||||
name: extractFileName(name),
|
||||
backend:
|
||||
isGGUF || isOllama
|
||||
@@ -290,8 +289,6 @@ const ModelFiles = () => {
|
||||
const initialValues = generateInitialValues(record);
|
||||
setOpenDeployModal({
|
||||
...openDeployModal,
|
||||
source: record.source,
|
||||
width: 600,
|
||||
modelFileOptions: dataList,
|
||||
gpuOptions: gpuList,
|
||||
initialValues: initialValues,
|
||||
@@ -400,7 +397,7 @@ const ModelFiles = () => {
|
||||
dataIndex: 'worker_name',
|
||||
render: (text: string, record: ListItem) => {
|
||||
return (
|
||||
<AutoTooltip ghost maxWidth={240}>
|
||||
<AutoTooltip ghost>
|
||||
<span>{getWorkerName(record.worker_id, workersList)}</span>
|
||||
</AutoTooltip>
|
||||
);
|
||||
@@ -417,6 +414,7 @@ const ModelFiles = () => {
|
||||
{
|
||||
title: intl.formatMessage({ id: 'resources.modelfiles.form.path' }),
|
||||
dataIndex: 'resolved_paths',
|
||||
width: '35%',
|
||||
render: (text: string, record: ListItem) => {
|
||||
if (
|
||||
!record.resolved_paths.length &&
|
||||
@@ -433,7 +431,7 @@ const ModelFiles = () => {
|
||||
return (
|
||||
record.resolved_paths?.length > 0 && (
|
||||
<span className="flex-center">
|
||||
<AutoTooltip ghost maxWidth={'100%'}>
|
||||
<AutoTooltip ghost>
|
||||
<span>{record.resolved_paths?.[0]}</span>
|
||||
</AutoTooltip>
|
||||
<CopyButton
|
||||
@@ -492,7 +490,7 @@ const ModelFiles = () => {
|
||||
<Space>
|
||||
<Input
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'resources.filter.file'
|
||||
id: 'resources.filter.source'
|
||||
})}
|
||||
style={{ width: 230 }}
|
||||
allowClear
|
||||
|
||||
Reference in New Issue
Block a user