chore: init worker selector
This commit is contained in:
@@ -2,7 +2,7 @@ import { CheckCircleFilled, CopyOutlined } from '@ant-design/icons';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Button, Tooltip, message } from 'antd';
|
||||
import ClipboardJS from 'clipboard';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
|
||||
type CopyButtonProps = {
|
||||
text: string;
|
||||
@@ -20,6 +20,7 @@ type CopyButtonProps = {
|
||||
| 'topRight'
|
||||
| 'bottomLeft'
|
||||
| 'bottomRight';
|
||||
btnStyle?: React.CSSProperties;
|
||||
style?: React.CSSProperties;
|
||||
};
|
||||
|
||||
@@ -30,6 +31,7 @@ const CopyButton: React.FC<CopyButtonProps> = ({
|
||||
shape = 'default',
|
||||
fontSize = '14px',
|
||||
style,
|
||||
btnStyle,
|
||||
placement,
|
||||
size = 'middle'
|
||||
}) => {
|
||||
@@ -77,6 +79,7 @@ const CopyButton: React.FC<CopyButtonProps> = ({
|
||||
size={size}
|
||||
disabled={!!disabled}
|
||||
data-clipboard-text={text}
|
||||
style={{ ...btnStyle }}
|
||||
icon={
|
||||
copied ? (
|
||||
<CheckCircleFilled
|
||||
|
||||
@@ -292,7 +292,6 @@ const AddModal: FC<AddModalProps> = (props) => {
|
||||
deploymentType === 'modelList' && (
|
||||
<TitleWrapper>
|
||||
{intl.formatMessage({ id: 'models.form.configurations' })}
|
||||
<span style={{ display: 'flex', height: 24 }}></span>
|
||||
</TitleWrapper>
|
||||
)}
|
||||
<DataForm
|
||||
|
||||
@@ -259,8 +259,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
);
|
||||
await updateModel({
|
||||
data: {
|
||||
...result.values,
|
||||
..._.omit(data, result.omits)
|
||||
...result.values
|
||||
},
|
||||
id: currentData.current?.id as number
|
||||
});
|
||||
@@ -296,8 +295,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
|
||||
const modelData = await createModel({
|
||||
data: {
|
||||
...result.values,
|
||||
..._.omit(data, result.omits)
|
||||
...result.values
|
||||
}
|
||||
});
|
||||
setOpenDeployModal({
|
||||
|
||||
@@ -2,7 +2,11 @@ import React from 'react';
|
||||
import '../style/title-wrapper.less';
|
||||
|
||||
const TitleWrapper: React.FC<any> = ({ children }) => {
|
||||
return <h3 className="h3">{children}</h3>;
|
||||
return (
|
||||
<h3 className="h3" style={{ height: 50 }}>
|
||||
{children}
|
||||
</h3>
|
||||
);
|
||||
};
|
||||
|
||||
export default TitleWrapper;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { StatusMaps } from '@/config';
|
||||
import { EditOutlined } from '@ant-design/icons';
|
||||
import _ from 'lodash';
|
||||
|
||||
export const ollamaModelOptions = [
|
||||
{
|
||||
@@ -345,8 +346,7 @@ export const getSourceRepoConfigValue = (
|
||||
source: string,
|
||||
data: any
|
||||
): {
|
||||
values: Record<string, any>;
|
||||
omits: string[];
|
||||
values: typeof data;
|
||||
} => {
|
||||
const config: Record<string, any> = sourceRepoConfig[source] || {};
|
||||
const result: Record<string, any> = {};
|
||||
@@ -359,8 +359,7 @@ export const getSourceRepoConfigValue = (
|
||||
});
|
||||
|
||||
return {
|
||||
values: result,
|
||||
omits: omits
|
||||
values: { ...result, ..._.omit(data, omits) }
|
||||
};
|
||||
};
|
||||
|
||||
@@ -369,7 +368,6 @@ export const setSourceRepoConfigValue = (
|
||||
data: any
|
||||
): {
|
||||
values: Record<string, any>;
|
||||
omits: string[];
|
||||
} => {
|
||||
const config: Record<string, any> = sourceRepoConfig[source] || {};
|
||||
const result: Record<string, any> = {};
|
||||
@@ -382,8 +380,7 @@ export const setSourceRepoConfigValue = (
|
||||
});
|
||||
|
||||
return {
|
||||
values: result,
|
||||
omits: omits
|
||||
values: { ...result, ..._.omit(data, omits) }
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@ export const useGenerateFormEditInitialValues = () => {
|
||||
|
||||
const formData = {
|
||||
...result.values,
|
||||
..._.omit(data, result.omits),
|
||||
categories: data?.categories?.length ? data.categories[0] : null,
|
||||
scheduleType: data?.gpu_selector ? 'manual' : 'auto',
|
||||
gpu_selector: data?.gpu_selector?.gpu_ids?.length
|
||||
|
||||
@@ -221,10 +221,18 @@ const ModelFiles = () => {
|
||||
).pop()
|
||||
);
|
||||
|
||||
const targetWorker = _.find(workersList, { value: record.worker_id })
|
||||
?.labels?.['worker-name'];
|
||||
|
||||
const result = setSourceRepoConfigValue(record.source, record);
|
||||
|
||||
return {
|
||||
...result.values,
|
||||
worker_selector: targetWorker
|
||||
? {
|
||||
'worker-name': targetWorker
|
||||
}
|
||||
: {},
|
||||
source: record.source,
|
||||
local_path: record.local_path,
|
||||
name: extractFileName(name),
|
||||
@@ -280,7 +288,6 @@ const ModelFiles = () => {
|
||||
]);
|
||||
const dataList = generateModelFileOptions(modelFileList, workersList);
|
||||
const initialValues = generateInitialValues(record);
|
||||
console.log('initialValues:', initialValues);
|
||||
setOpenDeployModal({
|
||||
...openDeployModal,
|
||||
source: record.source,
|
||||
@@ -359,8 +366,7 @@ const ModelFiles = () => {
|
||||
|
||||
const modelData = await createModel({
|
||||
data: {
|
||||
...result.values,
|
||||
..._.omit(data, result.omits)
|
||||
...result.values
|
||||
}
|
||||
});
|
||||
setOpenDeployModal({
|
||||
@@ -433,6 +439,7 @@ const ModelFiles = () => {
|
||||
<CopyButton
|
||||
text={record.resolved_paths?.[0]}
|
||||
type="link"
|
||||
btnStyle={{ width: 18, paddingInline: 2 }}
|
||||
></CopyButton>
|
||||
{renderParts(record)}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user