fix: clear backend parameters when change model file

This commit is contained in:
jialin
2025-05-29 11:32:23 +08:00
parent aa6b5ec24f
commit 40020df865
6 changed files with 122 additions and 44 deletions
@@ -23,12 +23,16 @@ const labelFormatter = (v: any) => {
return dayjs(v).format('MM-DD');
};
const dataList = [
{ label: '100M', value: 'Completion Tokens' },
{ label: '50M', value: 'Prompt Tokens' },
{ label: '120K', value: 'API Requests' }
];
const RequestTokenInner: React.FC<RequestTokenInnerProps> = (props) => {
const { requestData, tokenData, xAxisData } = props;
const intl = useIntl();
console.log('usage===========', requestData, tokenData, xAxisData);
return (
<CardWrapper style={{ width: '100%' }}>
<Row style={{ width: '100%' }}>
@@ -51,17 +55,6 @@ const RequestTokenInner: React.FC<RequestTokenInnerProps> = (props) => {
></BarChart>
</Col>
</Row>
{/* <MixLineBar
title={intl.formatMessage({ id: 'dashboard.apirequest' })}
chartData={{
line: requestData,
bar: tokenData
}}
seriesData={[]}
xAxisData={xAxisData}
height={360}
labelFormatter={labelFormatter}
></MixLineBar> */}
</CardWrapper>
);
};
@@ -125,9 +125,16 @@ const AddModal: React.FC<AddModalProps> = (props) => {
form.current?.submit?.();
};
// use for size change and quantization change
const pickSomeFieldsValue = () => {
const formData = form.current?.getFieldsValue();
return _.pick(formData, ['worker_selector', 'gpu_selector', 'env']);
return _.pick(formData, [
'worker_selector',
'gpu_selector',
'env',
'backend_version',
'backend_parameters'
]);
};
const generateSubmitData = (formData: FormData) => {
@@ -321,21 +328,6 @@ const AddModal: React.FC<AddModalProps> = (props) => {
});
};
const handleAdvanceOnValuesChange = (data: {
changedValues: any;
allValues: any;
source: string;
}) => {
handleOnValuesChange?.({
changedValues: data.changedValues,
allValues: {
..._.omit(selectSpecRef.current, ['name']),
...data.allValues
},
source: data.source
});
};
const handleBackendChange = (backend: string) => {
if (backend === backendOptionsMap.llamaBox) {
setIsGGUF(true);
@@ -28,7 +28,7 @@ import SearchModel from './search-model';
import Separator from './separator';
import TitleWrapper from './title-wrapper';
const resetFields = [
const resetFieldsByModel = [
'cpu_offloading',
'distributed_inference_across_workers',
'backend_version',
@@ -36,6 +36,11 @@ const resetFields = [
'env'
];
const resetFieldsByFile = [
'cpu_offloading',
'distributed_inference_across_workers'
];
const ModalFooterStyle = {
padding: '16px 24px',
display: 'flex',
@@ -136,7 +141,7 @@ const AddModal: FC<AddModalProps> = (props) => {
};
const handleSelectModelFile = (item: any, evaluate?: boolean) => {
form.current?.form?.resetFields(resetFields);
form.current?.form?.resetFields(resetFieldsByFile);
const modelInfo = onSelectModel(selectedModel, props.source);
form.current?.setFieldsValue?.({
file_name: item.fakeName,
@@ -156,9 +161,9 @@ const AddModal: FC<AddModalProps> = (props) => {
const handleOnSelectModel = (item: any, evaluate?: boolean) => {
setSelectedModel(item);
form.current?.form?.resetFields(resetFieldsByModel);
if (!item.isGGUF) {
setIsGGUF(false);
form.current?.form?.resetFields(resetFields);
const modelInfo = onSelectModel(item, props.source);
if (!isHolderRef.current.model) {
handleShowCompatibleAlert(item.evaluateResult);