fix(style): error message toast
This commit is contained in:
@@ -10,6 +10,7 @@ type CopyButtonProps = {
|
|||||||
fontSize?: string;
|
fontSize?: string;
|
||||||
btnStyle?: React.CSSProperties;
|
btnStyle?: React.CSSProperties;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
|
format?: 'text/plain' | 'text/html';
|
||||||
};
|
};
|
||||||
|
|
||||||
const CopyButton: React.FC<CopyButtonProps & TextProps> = ({
|
const CopyButton: React.FC<CopyButtonProps & TextProps> = ({
|
||||||
@@ -18,6 +19,7 @@ const CopyButton: React.FC<CopyButtonProps & TextProps> = ({
|
|||||||
fontSize = '14px',
|
fontSize = '14px',
|
||||||
style,
|
style,
|
||||||
btnStyle,
|
btnStyle,
|
||||||
|
format = 'text/plain',
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
@@ -35,6 +37,7 @@ const CopyButton: React.FC<CopyButtonProps & TextProps> = ({
|
|||||||
{...rest}
|
{...rest}
|
||||||
copyable={{
|
copyable={{
|
||||||
text: text,
|
text: text,
|
||||||
|
format: format,
|
||||||
tooltips: tooltips,
|
tooltips: tooltips,
|
||||||
icon: [
|
icon: [
|
||||||
<CopyOutlined style={{ fontSize: fontSize, ...style }} key="copy" />,
|
<CopyOutlined style={{ fontSize: fontSize, ...style }} key="copy" />,
|
||||||
|
|||||||
@@ -115,9 +115,6 @@ const ModelItem: React.FC<ModelItemProps> = ({
|
|||||||
...item,
|
...item,
|
||||||
name: ''
|
name: ''
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
|
||||||
setOpenTip(false);
|
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -153,6 +150,14 @@ const ModelItem: React.FC<ModelItemProps> = ({
|
|||||||
});
|
});
|
||||||
}, [providerModelList, item.name, selectedModelSet]);
|
}, [providerModelList, item.name, selectedModelSet]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (openTip) {
|
||||||
|
const timerId = setTimeout(() => setOpenTip(false), 2000);
|
||||||
|
return () => clearTimeout(timerId);
|
||||||
|
}
|
||||||
|
return () => {};
|
||||||
|
}, [openTip]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SelectWrapper>
|
<SelectWrapper>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
|
|||||||
@@ -36,12 +36,7 @@ const SupportedModels = () => {
|
|||||||
const currentAPIKey = form.getFieldValue('api_key') || '';
|
const currentAPIKey = form.getFieldValue('api_key') || '';
|
||||||
|
|
||||||
// Avoid repeated requests with the same API key
|
// Avoid repeated requests with the same API key
|
||||||
if (
|
if (open && prevAPIKeyRef.current !== currentAPIKey && currentAPIKey) {
|
||||||
open &&
|
|
||||||
providerModelList.length === 0 &&
|
|
||||||
prevAPIKeyRef.current !== currentAPIKey &&
|
|
||||||
currentAPIKey
|
|
||||||
) {
|
|
||||||
prevAPIKeyRef.current = currentAPIKey;
|
prevAPIKeyRef.current = currentAPIKey;
|
||||||
fetchProviderModels({
|
fetchProviderModels({
|
||||||
id: action === PageAction.EDIT ? id! : 0,
|
id: action === PageAction.EDIT ? id! : 0,
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ const Content = styled.div`
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
right: -4px;
|
right: -4px;
|
||||||
opacity: 5;
|
display: none;
|
||||||
|
}
|
||||||
|
&:hover .cp-btn {
|
||||||
|
display: inline-block;
|
||||||
}
|
}
|
||||||
.msg {
|
.msg {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user