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