fix: miss model file path in cloning
This commit is contained in:
@@ -273,7 +273,11 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
<Tag
|
<Tag
|
||||||
variant="filled"
|
variant="filled"
|
||||||
color="error"
|
color="error"
|
||||||
style={{ padding: '6px 8px', marginBottom: 16 }}
|
style={{
|
||||||
|
padding: '6px 8px',
|
||||||
|
marginBottom: 16,
|
||||||
|
width: '100%'
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{intl.formatMessage({ id: 'apikeys.table.save.tips' })}
|
{intl.formatMessage({ id: 'apikeys.table.save.tips' })}
|
||||||
</Tag>
|
</Tag>
|
||||||
@@ -281,14 +285,7 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
<SealInput.Input
|
<SealInput.Input
|
||||||
label={intl.formatMessage({ id: 'apikeys.form.apikey' })}
|
label={intl.formatMessage({ id: 'apikeys.form.apikey' })}
|
||||||
value={apikeyValue}
|
value={apikeyValue}
|
||||||
addAfter={
|
addAfter={<CopyButton text={apikeyValue}></CopyButton>}
|
||||||
<CopyButton
|
|
||||||
text={apikeyValue}
|
|
||||||
shape="default"
|
|
||||||
size="middle"
|
|
||||||
type="text"
|
|
||||||
></CopyButton>
|
|
||||||
}
|
|
||||||
></SealInput.Input>
|
></SealInput.Input>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import { Typography } from 'antd';
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import _, { round } from 'lodash';
|
import _, { round } from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
|
||||||
import {
|
import {
|
||||||
BenchmarkStatus,
|
BenchmarkStatus,
|
||||||
BenchmarkStatusLabelMap,
|
BenchmarkStatusLabelMap,
|
||||||
@@ -16,6 +15,7 @@ import {
|
|||||||
} from '../config';
|
} from '../config';
|
||||||
import { BenchmarkListItem as ListItem } from '../config/types';
|
import { BenchmarkListItem as ListItem } from '../config/types';
|
||||||
|
|
||||||
|
// sort by this order
|
||||||
const allFields = [
|
const allFields = [
|
||||||
'cluster_id',
|
'cluster_id',
|
||||||
'model_name',
|
'model_name',
|
||||||
@@ -45,15 +45,6 @@ const fieldSortPos: Record<string, number> = Object.fromEntries(
|
|||||||
allFields.map((field, index) => [field, index + 1])
|
allFields.map((field, index) => [field, index + 1])
|
||||||
);
|
);
|
||||||
|
|
||||||
const SubTitleWrapper = styled.span.attrs({
|
|
||||||
className: 'sub-title'
|
|
||||||
})`
|
|
||||||
display: list-item;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const defaultColumns: string[] = [
|
const defaultColumns: string[] = [
|
||||||
'model_name',
|
'model_name',
|
||||||
'dataset_name',
|
'dataset_name',
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
huggingface_filename: item.fakeName,
|
huggingface_filename: item.fakeName,
|
||||||
model_scope_file_path: item.fakeName,
|
model_scope_file_path: item.fakeName,
|
||||||
backend_parameters: [],
|
backend_parameters: [],
|
||||||
backend_version: '',
|
backend_version: null,
|
||||||
backend: modelInfo.backend,
|
backend: modelInfo.backend,
|
||||||
env: {
|
env: {
|
||||||
...modelInfo.env
|
...modelInfo.env
|
||||||
@@ -315,7 +315,7 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
handleCancelFiles();
|
handleCancelFiles();
|
||||||
if (
|
if (
|
||||||
_.isEmpty(item) ||
|
_.isEmpty(item) ||
|
||||||
(item.isGGUF === selectedModel.isGGUF && item.name === selectedModel.name)
|
(item.isGGUF === selectedModel.isGGUF && item.name === selectedModel.name) // --- because sometimes has the same model name with different isGGUF value
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -420,7 +420,6 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSetIsGGUF = async (flag: boolean) => {
|
const handleSetIsGGUF = async (flag: boolean) => {
|
||||||
console.log('isgguf==================>', flag);
|
|
||||||
setIsGGUF(flag);
|
setIsGGUF(flag);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -593,6 +592,7 @@ const AddModal: FC<AddModalProps> = (props) => {
|
|||||||
onCollapse={setCollapsed}
|
onCollapse={setCollapsed}
|
||||||
collapsed={collapsed}
|
collapsed={collapsed}
|
||||||
modelSource={props.source}
|
modelSource={props.source}
|
||||||
|
isGGUF={isGGUF}
|
||||||
setIsGGUF={handleSetIsGGUF}
|
setIsGGUF={handleSetIsGGUF}
|
||||||
></ModelCard>
|
></ModelCard>
|
||||||
{isGGUF && (
|
{isGGUF && (
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ const MarkDownTitle: React.FC<{
|
|||||||
loading: boolean;
|
loading: boolean;
|
||||||
onCollapse: () => void;
|
onCollapse: () => void;
|
||||||
}> = ({ collapsed, loading, onCollapse }) => {
|
}> = ({ collapsed, loading, onCollapse }) => {
|
||||||
const intl = useIntl();
|
|
||||||
return (
|
return (
|
||||||
<MkdTitle onClick={onCollapse}>
|
<MkdTitle onClick={onCollapse}>
|
||||||
<span>
|
<span>
|
||||||
@@ -68,12 +67,13 @@ const MarkDownTitle: React.FC<{
|
|||||||
const ModelCard: React.FC<{
|
const ModelCard: React.FC<{
|
||||||
onCollapse: (flag: boolean) => void;
|
onCollapse: (flag: boolean) => void;
|
||||||
setIsGGUF: (flag: boolean) => void;
|
setIsGGUF: (flag: boolean) => void;
|
||||||
|
isGGUF?: boolean;
|
||||||
selectedModel: any;
|
selectedModel: any;
|
||||||
collapsed: boolean;
|
collapsed: boolean;
|
||||||
loadingModel?: boolean;
|
loadingModel?: boolean;
|
||||||
modelSource: string;
|
modelSource: string;
|
||||||
}> = (props) => {
|
}> = (props) => {
|
||||||
const { onCollapse, setIsGGUF, collapsed, modelSource } = props;
|
const { onCollapse, setIsGGUF, collapsed, modelSource, isGGUF } = props;
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const requestSource = useRequestToken();
|
const requestSource = useRequestToken();
|
||||||
const [modelData, setModelData] = useState<any>(null);
|
const [modelData, setModelData] = useState<any>(null);
|
||||||
@@ -82,7 +82,6 @@ const ModelCard: React.FC<{
|
|||||||
const axiosTokenRef = useRef<any>(null);
|
const axiosTokenRef = useRef<any>(null);
|
||||||
const loadConfigTokenRef = useRef<any>(null);
|
const loadConfigTokenRef = useRef<any>(null);
|
||||||
const loadConfigJsonTokenRef = useRef<any>(null);
|
const loadConfigJsonTokenRef = useRef<any>(null);
|
||||||
const [isGGUFModel, setIsGGUFModel] = useState<boolean>(false);
|
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
const modelTags = useMemo(() => {
|
const modelTags = useMemo(() => {
|
||||||
@@ -169,8 +168,7 @@ const ModelCard: React.FC<{
|
|||||||
setReadmeText(newReadme);
|
setReadmeText(newReadme);
|
||||||
handleOnCollapse(newReadme);
|
handleOnCollapse(newReadme);
|
||||||
const isGGUF = modelcard.tags?.includes('gguf');
|
const isGGUF = modelcard.tags?.includes('gguf');
|
||||||
setIsGGUF(isGGUF);
|
setIsGGUF(isGGUF || props.selectedModel?.isGGUF);
|
||||||
setIsGGUFModel(isGGUF);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setModelData(null);
|
setModelData(null);
|
||||||
setReadmeText(null);
|
setReadmeText(null);
|
||||||
@@ -198,8 +196,7 @@ const ModelCard: React.FC<{
|
|||||||
data?.Data?.Tags,
|
data?.Data?.Tags,
|
||||||
(tag: string) => tag?.indexOf('gguf') > -1
|
(tag: string) => tag?.indexOf('gguf') > -1
|
||||||
);
|
);
|
||||||
setIsGGUF(isGGUF);
|
setIsGGUF(isGGUF || props.selectedModel?.isGGUF);
|
||||||
setIsGGUFModel(isGGUF);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setModelData(null);
|
setModelData(null);
|
||||||
setReadmeText(null);
|
setReadmeText(null);
|
||||||
@@ -290,11 +287,8 @@ const ModelCard: React.FC<{
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!props.selectedModel.name) return;
|
if (!props.selectedModel.name) return;
|
||||||
|
|
||||||
getModelCardData();
|
getModelCardData();
|
||||||
setIsGGUFModel(props.selectedModel.isGGUF);
|
|
||||||
setModelData(() => ({
|
setModelData(() => ({
|
||||||
...modelData,
|
|
||||||
id: props.selectedModel.name,
|
id: props.selectedModel.name,
|
||||||
name: props.selectedModel.name,
|
name: props.selectedModel.name,
|
||||||
isGGUF: props.selectedModel.isGGUF
|
isGGUF: props.selectedModel.isGGUF
|
||||||
@@ -328,7 +322,7 @@ const ModelCard: React.FC<{
|
|||||||
{modelType}
|
{modelType}
|
||||||
</ThemeTag>
|
</ThemeTag>
|
||||||
)}
|
)}
|
||||||
{isGGUFModel && (
|
{isGGUF && (
|
||||||
<ThemeTag className="tag-item" color="magenta" opacity={0.65}>
|
<ThemeTag className="tag-item" color="magenta" opacity={0.65}>
|
||||||
GGUF
|
GGUF
|
||||||
</ThemeTag>
|
</ThemeTag>
|
||||||
@@ -347,7 +341,7 @@ const ModelCard: React.FC<{
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
{readmeText && isGGUFModel && (
|
{readmeText && isGGUF && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
@@ -388,7 +382,7 @@ const ModelCard: React.FC<{
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{!isGGUFModel && (
|
{!isGGUF && (
|
||||||
<Spin spinning={loading}>
|
<Spin spinning={loading}>
|
||||||
<div style={{ minHeight: 200 }}>
|
<div style={{ minHeight: 200 }}>
|
||||||
{readmeText && (
|
{readmeText && (
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ const SearchModel: React.FC<SearchInputProps> = (props) => {
|
|||||||
|
|
||||||
const handleOnSelectModel = (model: any, manual?: boolean) => {
|
const handleOnSelectModel = (model: any, manual?: boolean) => {
|
||||||
const item = model || {};
|
const item = model || {};
|
||||||
|
// because need cancel the fetch file request when select another model, so check the empty model in the parent level handler.
|
||||||
if (!item.evaluated || item.isGGUF) {
|
if (!item.evaluated || item.isGGUF) {
|
||||||
onSelectModel(item, manual);
|
onSelectModel(item, manual);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import styled from 'styled-components';
|
|||||||
import { backendTipsList } from '../config';
|
import { backendTipsList } from '../config';
|
||||||
import { backendOptionsMap } from '../config/backend-parameters';
|
import { backendOptionsMap } from '../config/backend-parameters';
|
||||||
import { useFormContext } from '../config/form-context';
|
import { useFormContext } from '../config/form-context';
|
||||||
|
import useCompareEnvs from '../hooks/use-compare-envs';
|
||||||
|
|
||||||
const CaretDownWrapper = styled.span`
|
const CaretDownWrapper = styled.span`
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -36,6 +37,7 @@ const BackendFields: React.FC = () => {
|
|||||||
} = useFormContext();
|
} = useFormContext();
|
||||||
const backend = Form.useWatch('backend', form);
|
const backend = Form.useWatch('backend', form);
|
||||||
const [showDeprecated, setShowDeprecated] = React.useState<boolean>(false);
|
const [showDeprecated, setShowDeprecated] = React.useState<boolean>(false);
|
||||||
|
const { openTips, handleToggleTips, handleCompareEnvs } = useCompareEnvs();
|
||||||
|
|
||||||
const handleBackendVersionOnChange = (value: any, option: any) => {
|
const handleBackendVersionOnChange = (value: any, option: any) => {
|
||||||
if (Object.keys(option.data?.env || {}).length > 0) {
|
if (Object.keys(option.data?.env || {}).length > 0) {
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { WarningOutlined } from '@ant-design/icons';
|
||||||
|
import { Alert, Popover } from 'antd';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
interface EnvsOverridePopoverProps {
|
||||||
|
open: boolean;
|
||||||
|
dataList: any[];
|
||||||
|
onToggle: (open: boolean) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const EnvsOverridePopover: React.FC<EnvsOverridePopoverProps> = (props) => {
|
||||||
|
const { open, onToggle } = props;
|
||||||
|
return (
|
||||||
|
<Popover
|
||||||
|
content="override envs"
|
||||||
|
onOpenChange={onToggle}
|
||||||
|
trigger={'click'}
|
||||||
|
styles={{
|
||||||
|
container: {
|
||||||
|
width: '100%'
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Alert
|
||||||
|
onClick={() => onToggle(!open)}
|
||||||
|
style={{ marginBlock: 16, cursor: 'pointer' }}
|
||||||
|
icon={<WarningOutlined />}
|
||||||
|
type="warning"
|
||||||
|
showIcon
|
||||||
|
title={'override envs'}
|
||||||
|
></Alert>
|
||||||
|
</Popover>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EnvsOverridePopover;
|
||||||
@@ -171,19 +171,6 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkIsGGUF = () => {
|
|
||||||
const huggingface_filename = form.getFieldValue('huggingface_filename');
|
|
||||||
const model_scope_model_id = form.getFieldValue('model_scope_model_id');
|
|
||||||
const local_path = form.getFieldValue('local_path');
|
|
||||||
|
|
||||||
if (local_path) {
|
|
||||||
const isEndwithGGUF = _.endsWith(local_path, '.gguf');
|
|
||||||
const isBlobFile = local_path.split('/').pop().includes('sha256');
|
|
||||||
return isEndwithGGUF || isBlobFile;
|
|
||||||
}
|
|
||||||
return huggingface_filename || model_scope_model_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateFieldsOnGGUF = () => {
|
const updateFieldsOnGGUF = () => {
|
||||||
// when isGGUF is true, set distributed_inference_across_workers and cpu_offloading to true
|
// when isGGUF is true, set distributed_inference_across_workers and cpu_offloading to true
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -522,6 +522,7 @@ export const useSelectModel = (data: { gpuOptions: any[] }) => {
|
|||||||
flatBackendOptions?: any[];
|
flatBackendOptions?: any[];
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
|
console.log('options==========', options);
|
||||||
const { source, defaultBackend, flatBackendOptions } = options;
|
const { source, defaultBackend, flatBackendOptions } = options;
|
||||||
let name = _.split(selectModel.name, '/').slice(-1)[0];
|
let name = _.split(selectModel.name, '/').slice(-1)[0];
|
||||||
const reg = /(-gguf)$/i;
|
const reg = /(-gguf)$/i;
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
|
export default function useCompareEnvs() {
|
||||||
|
const [openTips, setOpenTips] = useState(false);
|
||||||
|
const [diffEnvs, setDiffEnvs] = useState<{
|
||||||
|
old: Record<string, any>;
|
||||||
|
new: Record<string, any>;
|
||||||
|
} | null>(null);
|
||||||
|
|
||||||
|
const handleOpenTips = () => {
|
||||||
|
setOpenTips(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCloseTips = () => {
|
||||||
|
setOpenTips(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCompareEnvs = (
|
||||||
|
oldEnvs: Record<string, any>,
|
||||||
|
newEnvs: Record<string, any>
|
||||||
|
) => {
|
||||||
|
const result = {
|
||||||
|
old: {} as Record<string, any>,
|
||||||
|
new: {} as Record<string, any>
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.keys(oldEnvs).forEach((key) => {
|
||||||
|
if (key in newEnvs && oldEnvs[key] !== newEnvs[key]) {
|
||||||
|
result.old[key] = oldEnvs[key];
|
||||||
|
result.new[key] = newEnvs[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setDiffEnvs(result);
|
||||||
|
if (Object.keys(result.old).length > 0) {
|
||||||
|
handleOpenTips();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleToggleTips = () => {
|
||||||
|
setOpenTips(!openTips);
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
openTips,
|
||||||
|
diffEnvs,
|
||||||
|
handleOpenTips,
|
||||||
|
handleCloseTips,
|
||||||
|
handleCompareEnvs,
|
||||||
|
handleToggleTips
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { PageAction } from '@/config';
|
import { PageAction } from '@/config';
|
||||||
import { PageActionType } from '@/config/types';
|
import { PageActionType } from '@/config/types';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
|
import _ from 'lodash';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { ListItem } from '../config/types';
|
import { ListItem } from '../config/types';
|
||||||
|
|
||||||
@@ -27,12 +28,26 @@ const useEditDeployment = () => {
|
|||||||
title: ''
|
title: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const checkIsGGUF = (row: ListItem): boolean => {
|
||||||
|
const huggingface_filename = row.huggingface_filename;
|
||||||
|
const model_scope_file_path = row.model_scope_file_path;
|
||||||
|
const local_path = row.local_path || '';
|
||||||
|
|
||||||
|
if (local_path) {
|
||||||
|
const isEndwithGGUF = _.endsWith(local_path, '.gguf');
|
||||||
|
const isBlobFile = local_path.split('/').pop()?.includes('sha256');
|
||||||
|
return isEndwithGGUF || isBlobFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Boolean(huggingface_filename || model_scope_file_path);
|
||||||
|
};
|
||||||
|
|
||||||
const openEditModal = (formData: any, row: ListItem) => {
|
const openEditModal = (formData: any, row: ListItem) => {
|
||||||
setOpenModalStatus({
|
setOpenModalStatus({
|
||||||
open: true,
|
open: true,
|
||||||
action: PageAction.EDIT,
|
action: PageAction.EDIT,
|
||||||
currentData: {
|
currentData: {
|
||||||
isGGUF: false,
|
isGGUF: checkIsGGUF(row),
|
||||||
data: formData,
|
data: formData,
|
||||||
row: row,
|
row: row,
|
||||||
realAction: PageAction.EDIT
|
realAction: PageAction.EDIT
|
||||||
@@ -46,7 +61,7 @@ const useEditDeployment = () => {
|
|||||||
open: true,
|
open: true,
|
||||||
action: PageAction.EDIT,
|
action: PageAction.EDIT,
|
||||||
currentData: {
|
currentData: {
|
||||||
isGGUF: false,
|
isGGUF: checkIsGGUF(row),
|
||||||
data: {
|
data: {
|
||||||
...formData,
|
...formData,
|
||||||
name: `${formData.name}-copy`
|
name: `${formData.name}-copy`
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ const RouteItem: React.FC<TargetItemProps> = ({
|
|||||||
<AutoTooltip ghost>{data.name}</AutoTooltip>
|
<AutoTooltip ghost>{data.name}</AutoTooltip>
|
||||||
</CellContent>
|
</CellContent>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={5} style={{ paddingLeft: 56 }}>
|
<Col span={5} style={{ paddingLeft: 64 }}>
|
||||||
<CellContent>{renderProviderSource()}</CellContent>
|
<CellContent>{renderProviderSource()}</CellContent>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={2}>
|
<Col span={2}>
|
||||||
|
|||||||
@@ -442,7 +442,8 @@ const GroundSTT: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 20,
|
top: 20,
|
||||||
right: 2
|
right: 32,
|
||||||
|
zIndex: 10
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CopyButton text={messageList[0]?.content}></CopyButton>
|
<CopyButton text={messageList[0]?.content}></CopyButton>
|
||||||
|
|||||||
Reference in New Issue
Block a user