From fba430999da94d84d70a7558ad94f4e07eea3608 Mon Sep 17 00:00:00 2001 From: jialin Date: Mon, 9 Feb 2026 09:34:28 +0800 Subject: [PATCH] fix(style): error message toast --- src/components/copy-button/index.tsx | 3 +++ src/pages/maas-provider/forms/model-item.tsx | 11 ++++++++--- src/pages/maas-provider/forms/supported-models.tsx | 7 +------ src/request-config.tsx | 5 ++++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/components/copy-button/index.tsx b/src/components/copy-button/index.tsx index e1d465c8..21ef2a3d 100644 --- a/src/components/copy-button/index.tsx +++ b/src/components/copy-button/index.tsx @@ -10,6 +10,7 @@ type CopyButtonProps = { fontSize?: string; btnStyle?: React.CSSProperties; style?: React.CSSProperties; + format?: 'text/plain' | 'text/html'; }; const CopyButton: React.FC = ({ @@ -18,6 +19,7 @@ const CopyButton: React.FC = ({ fontSize = '14px', style, btnStyle, + format = 'text/plain', ...rest }) => { const intl = useIntl(); @@ -35,6 +37,7 @@ const CopyButton: React.FC = ({ {...rest} copyable={{ text: text, + format: format, tooltips: tooltips, icon: [ , diff --git a/src/pages/maas-provider/forms/model-item.tsx b/src/pages/maas-provider/forms/model-item.tsx index f0e0cacc..1d8887c9 100644 --- a/src/pages/maas-provider/forms/model-item.tsx +++ b/src/pages/maas-provider/forms/model-item.tsx @@ -115,9 +115,6 @@ const ModelItem: React.FC = ({ ...item, name: '' }); - setTimeout(() => { - setOpenTip(false); - }, 2000); } }; @@ -153,6 +150,14 @@ const ModelItem: React.FC = ({ }); }, [providerModelList, item.name, selectedModelSet]); + React.useEffect(() => { + if (openTip) { + const timerId = setTimeout(() => setOpenTip(false), 2000); + return () => clearTimeout(timerId); + } + return () => {}; + }, [openTip]); + return ( { const currentAPIKey = form.getFieldValue('api_key') || ''; // Avoid repeated requests with the same API key - if ( - open && - providerModelList.length === 0 && - prevAPIKeyRef.current !== currentAPIKey && - currentAPIKey - ) { + if (open && prevAPIKeyRef.current !== currentAPIKey && currentAPIKey) { prevAPIKeyRef.current = currentAPIKey; fetchProviderModels({ id: action === PageAction.EDIT ? id! : 0, diff --git a/src/request-config.tsx b/src/request-config.tsx index 3f820941..ef6b28ae 100644 --- a/src/request-config.tsx +++ b/src/request-config.tsx @@ -11,7 +11,10 @@ const Content = styled.div` position: absolute; top: 0px; right: -4px; - opacity: 5; + display: none; + } + &:hover .cp-btn { + display: inline-block; } .msg { display: none;