From f732f5c390e8aca1055d07a1311eac1c1c303176 Mon Sep 17 00:00:00 2001 From: jialin Date: Thu, 16 Oct 2025 15:03:48 +0800 Subject: [PATCH] fix: cluster issues --- src/components/seal-form/seal-textarea.tsx | 5 ++- src/components/seal-form/wrapper/input.ts | 1 + src/pages/llmodels/forms/index.tsx | 42 ++++++++++++++-------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/components/seal-form/seal-textarea.tsx b/src/components/seal-form/seal-textarea.tsx index 44bcd3c6..7853572b 100644 --- a/src/components/seal-form/seal-textarea.tsx +++ b/src/components/seal-form/seal-textarea.tsx @@ -18,6 +18,7 @@ const LabelWrapper = styled.div.attrs({ display: flex; align-items: center; justify-content: flex-start; + padding-bottom: 2px; background-color: var(--ant-color-bg-container); `; @@ -111,11 +112,13 @@ const SealTextArea: React.FC = ( [onInput] ); + console.log('style=========', style, rest); + return ( {label}} isFocus={isFocus} required={required} description={description} diff --git a/src/components/seal-form/wrapper/input.ts b/src/components/seal-form/wrapper/input.ts index 174ae18e..63edd699 100644 --- a/src/components/seal-form/wrapper/input.ts +++ b/src/components/seal-form/wrapper/input.ts @@ -76,6 +76,7 @@ const InputWrapper = styled.div` } .ant-input.seal-textarea { flex: 1; + overflow-y: auto !important; } .ant-input-number { diff --git a/src/pages/llmodels/forms/index.tsx b/src/pages/llmodels/forms/index.tsx index 70634097..ca89b547 100644 --- a/src/pages/llmodels/forms/index.tsx +++ b/src/pages/llmodels/forms/index.tsx @@ -20,6 +20,8 @@ import useQueryBackends from '../hooks/use-query-backends'; import AdvanceConfig from './advance-config'; import BasicForm from './basic'; +const requiredFields = ['gpu_selector', 'backend']; + interface DataFormProps { initialValues?: any; ref?: any; @@ -147,18 +149,24 @@ const DataForm: React.FC = forwardRef((props, ref) => { setActiveKey(Array.isArray(keys) ? keys : [keys]); }; + const handleOnFinishFailed = (errorInfo: any) => { + const { errorFields } = errorInfo; + if (errorFields && errorFields.length > 0) { + const names = errorFields.map((item: any) => item.name[0]); + const isRequired = names.some((name: string) => + requiredFields.includes(name) + ); + if (isRequired) { + setActiveKey(['advanced']); + } + } + }; + const handleTargetChange = (val: string) => { - console.log('val', val); - // if (val === 'performance' && performanceRef.current) { - // scrollToTarget?.(performanceRef.current); - // } - // if (val === 'advanced' && advanceRef.current) { - // scrollToTarget?.(advanceRef.current); - // } - // scrollToBottom?.(); - // setTimeout(() => { - // setTarget(val); - // }, 100); + form.scrollToField(val, { + behavior: 'smooth', + block: 'center' + }); }; useImperativeHandle(ref, () => { @@ -202,22 +210,25 @@ const DataForm: React.FC = forwardRef((props, ref) => { onBackendChange: handleBackendChange }} > - {/*
+ {/*
= forwardRef((props, ref) => { preserve={false} clearOnDestroy={true} onValuesChange={handleOnValuesChange} + onFinishFailed={handleOnFinishFailed} scrollToFirstError={true} initialValues={{ replicas: 1,