fix: replicas trigger compatibility
This commit is contained in:
@@ -8,8 +8,8 @@ import React, { useEffect, useMemo, useRef } from 'react';
|
|||||||
import ColumnWrapper from '../../_components/column-wrapper';
|
import ColumnWrapper from '../../_components/column-wrapper';
|
||||||
import {
|
import {
|
||||||
deployFormKeyMap,
|
deployFormKeyMap,
|
||||||
ScheduleValueMap,
|
DO_NOT_NOTIFY_RECREATE,
|
||||||
updateIgnoreFields
|
ScheduleValueMap
|
||||||
} from '../config';
|
} from '../config';
|
||||||
import { backendOptionsMap } from '../config/backend-parameters';
|
import { backendOptionsMap } from '../config/backend-parameters';
|
||||||
import { FormData } from '../config/types';
|
import { FormData } from '../config/types';
|
||||||
@@ -65,6 +65,12 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
const setOriginalFormData = () => {
|
const setOriginalFormData = () => {
|
||||||
if (!originFormData.current) {
|
if (!originFormData.current) {
|
||||||
originFormData.current = _.cloneDeep(formData);
|
originFormData.current = _.cloneDeep(formData);
|
||||||
|
if (!originFormData.current.extended_kv_cache?.enabled) {
|
||||||
|
originFormData.current.extended_kv_cache = {
|
||||||
|
enabled: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// TODO: set speculative_config
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -80,6 +86,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// this function is used compare form data changes in updating model, and show warning if needed
|
||||||
const handleOnValuesChange = _.debounce((data: any) => {
|
const handleOnValuesChange = _.debounce((data: any) => {
|
||||||
const formdata = formRef.current?.getFieldsValue?.();
|
const formdata = formRef.current?.getFieldsValue?.();
|
||||||
console.log('handleOnValuesChange:', formdata);
|
console.log('handleOnValuesChange:', formdata);
|
||||||
@@ -103,13 +110,13 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const originalData = _.pick(originFormData.current, Object.keys(alldata));
|
const originalData = _.pick(originFormData.current, Object.keys(alldata));
|
||||||
console.log('alldata:', formdata, alldata, originalData);
|
|
||||||
|
|
||||||
const isEqual = _.isEqualWith(
|
const isEqual = _.isEqualWith(
|
||||||
_.omit(alldata, updateIgnoreFields),
|
_.omit(alldata, DO_NOT_NOTIFY_RECREATE),
|
||||||
_.omit(originalData, updateIgnoreFields),
|
_.omit(originalData, DO_NOT_NOTIFY_RECREATE),
|
||||||
customizer
|
customizer
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isEqual) {
|
if (isEqual) {
|
||||||
setWarningStatus({
|
setWarningStatus({
|
||||||
show: false,
|
show: false,
|
||||||
@@ -175,7 +182,6 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleManulOnValuesChange = (changedValues: any, allValues: any) => {
|
const handleManulOnValuesChange = (changedValues: any, allValues: any) => {
|
||||||
console.log('handleManulOnValuesChange:', { changedValues, allValues });
|
|
||||||
handleOnValuesChange({
|
handleOnValuesChange({
|
||||||
changedValues,
|
changedValues,
|
||||||
allValues,
|
allValues,
|
||||||
|
|||||||
@@ -322,13 +322,12 @@ export const modelLabels = [
|
|||||||
{ label: 'Embedding', value: 'embedding_only' }
|
{ label: 'Embedding', value: 'embedding_only' }
|
||||||
];
|
];
|
||||||
|
|
||||||
// do not trigger form check compatibility
|
// do not trigger form check compatibility when these fields change
|
||||||
export const excludeFields = [
|
export const DO_NOT_TRIGGER_CHECK_COMPATIBILITY = [
|
||||||
'model_scope_model_id',
|
'model_scope_model_id',
|
||||||
'huggingface_repo_id',
|
'huggingface_repo_id',
|
||||||
'huggingface_filename',
|
'huggingface_filename',
|
||||||
'model_scope_file_path',
|
'model_scope_file_path',
|
||||||
'replicas',
|
|
||||||
'name',
|
'name',
|
||||||
'description',
|
'description',
|
||||||
'env',
|
'env',
|
||||||
@@ -350,11 +349,11 @@ export const excludeFields = [
|
|||||||
'extended_kv_cache.enabled'
|
'extended_kv_cache.enabled'
|
||||||
];
|
];
|
||||||
|
|
||||||
// ingore fields when compare old and new data
|
// ignore to compare old and new data when these fields change in updating model
|
||||||
export const updateIgnoreFields = ['categories', 'replicas', 'description'];
|
export const DO_NOT_NOTIFY_RECREATE = ['categories', 'replicas', 'description'];
|
||||||
|
|
||||||
// if some fields need to trigger manual check, add them here
|
// if some fields need to trigger manual check, add them here
|
||||||
export const updateExcludeFields = [
|
export const TRIGGER_CHECK_MANUAL = [
|
||||||
'model_scope_model_id',
|
'model_scope_model_id',
|
||||||
'huggingface_repo_id',
|
'huggingface_repo_id',
|
||||||
'huggingface_filename',
|
'huggingface_filename',
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import {
|
import {
|
||||||
deployFormKeyMap,
|
deployFormKeyMap,
|
||||||
excludeFields,
|
DO_NOT_NOTIFY_RECREATE,
|
||||||
|
DO_NOT_TRIGGER_CHECK_COMPATIBILITY,
|
||||||
modelSourceMap,
|
modelSourceMap,
|
||||||
ScheduleValueMap
|
ScheduleValueMap
|
||||||
} from '../config';
|
} from '../config';
|
||||||
@@ -249,7 +250,10 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
|||||||
const handleOnValuesChange = async (changedValues: any, allValues: any) => {
|
const handleOnValuesChange = async (changedValues: any, allValues: any) => {
|
||||||
const fieldName = getFieldPaths(changedValues);
|
const fieldName = getFieldPaths(changedValues);
|
||||||
|
|
||||||
if (excludeFields.includes(fieldName)) {
|
if (
|
||||||
|
DO_NOT_TRIGGER_CHECK_COMPATIBILITY.includes(fieldName) ||
|
||||||
|
(DO_NOT_NOTIFY_RECREATE.includes(fieldName) && action === PageAction.EDIT)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onValuesChange?.(changedValues, allValues);
|
onValuesChange?.(changedValues, allValues);
|
||||||
|
|||||||
Reference in New Issue
Block a user