chore: pluggable locale config

This commit is contained in:
jialin
2025-10-13 14:40:26 +08:00
parent caabeb065a
commit b5fa40047a
30 changed files with 731 additions and 575 deletions
@@ -245,6 +245,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
return result;
};
// TODO need check the backend is available
const handleSetBackendOptions = () => {
const backendGroup = _.groupBy(specListRef.current, 'backend');
@@ -495,6 +496,9 @@ const AddModal: React.FC<AddModalProps> = (props) => {
form.current?.getGPUOptionList?.({
clusterId: initClusterId()
});
form.current?.getBackendOptions?.({
cluster_id: initClusterId()
});
}, 100);
}
return () => {
@@ -596,7 +600,6 @@ const AddModal: React.FC<AddModalProps> = (props) => {
isGGUF={isGGUF}
formKey={deployFormKeyMap.catalog}
sourceDisable={false}
backendOptions={backendList}
sourceList={sourceList}
clusterList={clusterList}
onBackendChange={handleBackendChange}
+13 -10
View File
@@ -10,7 +10,7 @@ import styled from 'styled-components';
import ColumnWrapper from '../../_components/column-wrapper';
import { defaultFormValues, deployFormKeyMap, modelSourceMap } from '../config';
import { backendOptionsMap } from '../config/backend-parameters';
import { BackendOption, FormData, SourceType } from '../config/types';
import { FormData, SourceType } from '../config/types';
import DataForm from '../forms';
import {
MessageStatus,
@@ -63,7 +63,6 @@ type AddModalProps = {
width?: string | number;
initialValues?: any;
deploymentType?: 'modelList' | 'modelFiles';
backendOptions: BackendOption[];
clusterList: Global.BaseOption<
number,
{ provider: string; state: string | number }
@@ -326,15 +325,17 @@ const AddModal: FC<AddModalProps> = (props) => {
return;
}
if (data.local_path || props.source !== modelSourceMap.local_path_value) {
// TODO confirm wheather it is gguf by model file not by backend
handleOnValuesChange?.({
changedValues: {},
allValues:
backend === backendOptionsMap.llamaBox
? data
: _.omit(data, [
'cpu_offloading',
'distributed_inference_across_workers'
]),
// allValues:
// backend === backendOptionsMap.llamaBox
// ? data
// : _.omit(data, [
// 'cpu_offloading',
// 'distributed_inference_across_workers'
// ]),
allValues: data,
source: props.source
});
}
@@ -413,6 +414,9 @@ const AddModal: FC<AddModalProps> = (props) => {
form.current?.getGPUOptionList?.({
clusterId: initClusterId()
});
form.current?.getBackendOptions?.({
cluster_id: initClusterId()
});
} else {
cancelEvaluate();
clearCahceFormValues();
@@ -542,7 +546,6 @@ const AddModal: FC<AddModalProps> = (props) => {
onOk={handleOnOk}
ref={form}
isGGUF={isGGUF}
backendOptions={props.backendOptions}
onBackendChange={handleBackendChange}
onValuesChange={onValuesChange}
></DataForm>
+1 -6
View File
@@ -42,7 +42,6 @@ import {
modelCategoriesMap,
modelSourceMap
} from '../config';
import { backendOptionsMap } from '../config/backend-parameters';
import {
ButtonList,
categoryToPathMap,
@@ -57,7 +56,6 @@ import {
} from '../config/types';
import useFormInitialValues from '../hooks/use-form-initial-values';
import useModelsColumns from '../hooks/use-models-columns';
import useQueryBackends from '../hooks/use-query-backends';
import APIAccessInfoModal from './api-access-info';
import DeployModal from './deploy-modal';
import Instances from './instances';
@@ -124,7 +122,6 @@ const Models: React.FC<ModelsProps> = ({
loadend,
total
}) => {
const { backendOptions } = useQueryBackends();
const { generateFormValues, clusterList, getClusterList } =
useFormInitialValues();
const { saveScrollHeight, restoreScrollHeight } = useBodyScroll();
@@ -401,7 +398,7 @@ const Models: React.FC<ModelsProps> = ({
const initialValues = generateFormValues(row, []);
setUpdateFormInitials({
data: initialValues,
isGGUF: row.backend === backendOptionsMap.llamaBox
isGGUF: false
});
setCurrentData(row);
setOpenAddModal(true);
@@ -693,7 +690,6 @@ const Models: React.FC<ModelsProps> = ({
clusterList={clusterList}
onCancel={handleModalCancel}
onOk={handleModalOk}
backendOptions={backendOptions}
></UpdateModelModal>
<DeployModal
open={openDeployModal.show}
@@ -704,7 +700,6 @@ const Models: React.FC<ModelsProps> = ({
isGGUF={openDeployModal.isGGUF}
hasLinuxWorker={openDeployModal.hasLinuxWorker}
clusterList={clusterList}
backendOptions={backendOptions}
onCancel={handleDeployModalCancel}
onOk={handleCreateModel}
></DeployModal>
@@ -12,7 +12,7 @@ import {
updateIgnoreFields
} from '../config';
import { backendOptionsMap } from '../config/backend-parameters';
import { BackendOption, FormData } from '../config/types';
import { FormData } from '../config/types';
import { generateGPUSelector } from '../config/utils';
import DataForm from '../forms';
import { useCheckCompatibility } from '../hooks';
@@ -26,7 +26,6 @@ type AddModalProps = {
data: FormData;
isGGUF: boolean;
};
backendOptions: BackendOption[];
clusterList: Global.BaseOption<
number,
{ provider: string; state: string | number }
@@ -326,7 +325,6 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
onOk={handleOk}
ref={formRef}
isGGUF={isGGUF}
backendOptions={props.backendOptions}
onBackendChange={handleAsyncBackendChange}
onValuesChange={handleManulOnValuesChange}
></DataForm>