fix: model filter by worker

This commit is contained in:
jialin
2025-04-01 10:56:50 +08:00
parent eff88528d3
commit 7e8b5f1f63
12 changed files with 72 additions and 182 deletions
@@ -79,6 +79,7 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = forwardRef(
])
);
form.setFieldsValue(normalizedValues);
console.log('handleValuesChange', normalizedValues, allValues);
onValuesChange?.(normalizedValues, {
...allValues,
...normalizedValues
@@ -19,7 +19,7 @@ import _ from 'lodash';
import { PCA } from 'ml-pca';
import 'overlayscrollbars/overlayscrollbars.css';
import { Resizable } from 're-resizable';
import {
import React, {
forwardRef,
useCallback,
useEffect,
@@ -438,9 +438,8 @@ const GroundEmbedding: React.FC<MessageProps> = forwardRef((props, ref) => {
if (changeValues.model) {
setScatterData([]);
setTokenResult(null);
} else {
handleOnValuesChange(changeValues, allValues);
}
handleOnValuesChange(changeValues, allValues);
},
[]
);
@@ -13,7 +13,7 @@ import { Button, Checkbox, Form, Input, Spin, Tag, Tooltip } from 'antd';
import classNames from 'classnames';
import _ from 'lodash';
import 'overlayscrollbars/overlayscrollbars.css';
import {
import React, {
forwardRef,
useCallback,
useEffect,
@@ -113,7 +113,6 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
const [sortIndexMap, setSortIndexMap] = useState<number[]>([]);
const [queryValue, setQueryValue] = useState<string>('');
const selectionTextRef = useRef<any>(null);
const [metaData, setMetaData] = useState<any>({});
const { initialize, updateScrollerPosition: updateDocumentScrollerPosition } =
useOverlayScroller();
@@ -353,7 +352,6 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
if (!multiplePasteEnable.current) return;
const text = e.clipboardData.getData('text');
if (text) {
const currentContent = textList[index]?.text;
const dataLlist = text.split('\n').map((item: string) => {
return {
text: item?.trim(),
@@ -432,9 +430,8 @@ const GroundReranker: React.FC<MessageProps> = forwardRef((props, ref) => {
const onValuesChange = useCallback((changedValues: any, allValues: any) => {
if (changedValues.model) {
setTokenResult(null);
} else {
handleOnValuesChange(changedValues, allValues);
}
handleOnValuesChange(changedValues, allValues);
}, []);
// useHotkeys(
@@ -1,106 +0,0 @@
import FieldComponent from '@/components/seal-form/field-component';
import { useIntl } from '@umijs/max';
import { Form } from 'antd';
import _ from 'lodash';
import {
forwardRef,
memo,
useCallback,
useEffect,
useId,
useImperativeHandle,
useMemo
} from 'react';
import { ParamsSchema } from '../config/types';
type ParamsSettingsProps = {
ref?: any;
style?: React.CSSProperties;
onValuesChange?: (changeValues: any, value: Record<string, any>) => void;
paramsConfig?: ParamsSchema[];
initialValues?: Record<string, any>;
extra?: React.ReactNode;
};
const ParamsSettings: React.FC<ParamsSettingsProps> = forwardRef(
({ onValuesChange, style, paramsConfig, initialValues, extra }, ref) => {
const intl = useIntl();
const [form] = Form.useForm();
const formId = useId();
useImperativeHandle(ref, () => ({
form
}));
useEffect(() => {
form.setFieldsValue({
...initialValues
});
}, [initialValues]);
const handleOnFinish = (values: any) => {
console.log('handleOnFinish', values);
};
const handleOnFinishFailed = (errorInfo: any) => {
console.log('handleOnFinishFailed', errorInfo);
};
const handleValuesChange = useCallback(
(changedValues: any, allValues: any) => {
onValuesChange?.(changedValues, allValues);
},
[onValuesChange]
);
const renderFields = useMemo(() => {
if (!paramsConfig) {
return null;
}
const formValues = form?.getFieldsValue();
return paramsConfig?.map((item: ParamsSchema) => {
return (
<Form.Item name={item.name} rules={item.rules} key={item.name}>
<FieldComponent
disabled={
item.disabledConfig
? item.disabledConfig?.when?.(formValues)
: item.disabled
}
description={
item.description?.isLocalized
? intl.formatMessage({ id: item.description.text })
: item.description?.text
}
onChange={null}
{..._.omit(item, [
'name',
'rules',
'disabledConfig',
'description'
])}
></FieldComponent>
</Form.Item>
);
});
}, [paramsConfig, intl]);
return (
<Form
style={{ ...style }}
name={formId}
form={form}
onValuesChange={handleValuesChange}
onFinish={handleOnFinish}
onFinishFailed={handleOnFinishFailed}
>
<div>
{renderFields}
{extra}
</div>
</Form>
);
}
);
export default memo(ParamsSettings);
+1
View File
@@ -77,6 +77,7 @@
border-radius: 4px;
align-items: center;
transform: scale(0.85);
font-weight: var(--font-weight-500);
}
}
}
@@ -529,7 +529,7 @@ const ModelFiles = () => {
handleDeleteByBatch={handleDeleteByBatch}
handleClickPrimary={handleClickDropdown}
handleSearch={handleSearch}
selectOptions={onLineSourceOptions}
selectOptions={workersList}
handleInputChange={handleNameChange}
rowSelection={rowSelection}
actionItems={onLineSourceOptions}
+2 -2
View File
@@ -308,8 +308,8 @@ const Workers: React.FC = () => {
borderRadius: 12
}}
>
<span className="font-600">{key}</span>
<span className="text-tertiary">:{value}</span>
<span>{key}</span>
<span>:{value}</span>
</AutoTooltip>
);
})}