|
|
@@ -17,7 +17,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
|
*/
|
|
|
|
|
|
-import React from 'react';
|
|
|
+import React, { useState } from 'react';
|
|
|
+import { Banner, Button, Modal } from '@douyinfe/semi-ui';
|
|
|
+import { IconAlertTriangle, IconClose } from '@douyinfe/semi-icons';
|
|
|
import CardPro from '../../common/ui/CardPro';
|
|
|
import ModelsTable from './ModelsTable';
|
|
|
import ModelsActions from './ModelsActions';
|
|
|
@@ -29,6 +31,9 @@ import { useModelsData } from '../../../hooks/models/useModelsData';
|
|
|
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
|
|
import { createCardProPagination } from '../../../helpers/utils';
|
|
|
|
|
|
+const MARKETPLACE_DISPLAY_NOTICE_STORAGE_KEY =
|
|
|
+ 'models_marketplace_display_notice_dismissed';
|
|
|
+
|
|
|
const ModelsPage = () => {
|
|
|
const modelsData = useModelsData();
|
|
|
const isMobile = useIsMobile();
|
|
|
@@ -71,6 +76,37 @@ const ModelsPage = () => {
|
|
|
t,
|
|
|
} = modelsData;
|
|
|
|
|
|
+ const [showMarketplaceDisplayNotice, setShowMarketplaceDisplayNotice] =
|
|
|
+ useState(() => {
|
|
|
+ try {
|
|
|
+ return (
|
|
|
+ localStorage.getItem(MARKETPLACE_DISPLAY_NOTICE_STORAGE_KEY) !== '1'
|
|
|
+ );
|
|
|
+ } catch (_) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ const confirmCloseMarketplaceDisplayNotice = () => {
|
|
|
+ Modal.confirm({
|
|
|
+ title: t('确认关闭提示'),
|
|
|
+ content: t(
|
|
|
+ '关闭后将不再显示此提示(仅对当前浏览器生效)。确定要关闭吗?',
|
|
|
+ ),
|
|
|
+ okText: t('关闭提示'),
|
|
|
+ cancelText: t('取消'),
|
|
|
+ okButtonProps: {
|
|
|
+ type: 'danger',
|
|
|
+ },
|
|
|
+ onOk: () => {
|
|
|
+ try {
|
|
|
+ localStorage.setItem(MARKETPLACE_DISPLAY_NOTICE_STORAGE_KEY, '1');
|
|
|
+ } catch (_) {}
|
|
|
+ setShowMarketplaceDisplayNotice(false);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<EditModelModal
|
|
|
@@ -94,6 +130,33 @@ const ModelsPage = () => {
|
|
|
}}
|
|
|
/>
|
|
|
|
|
|
+ {showMarketplaceDisplayNotice ? (
|
|
|
+ <div style={{ position: 'relative', marginBottom: 12 }}>
|
|
|
+ <Banner
|
|
|
+ type='warning'
|
|
|
+ closeIcon={null}
|
|
|
+ icon={
|
|
|
+ <IconAlertTriangle
|
|
|
+ size='large'
|
|
|
+ style={{ color: 'var(--semi-color-warning)' }}
|
|
|
+ />
|
|
|
+ }
|
|
|
+ description={t(
|
|
|
+ '提示:此处配置仅用于控制「模型广场」对用户的展示效果,不会影响模型的实际调用与路由。若需配置真实调用行为,请前往「渠道管理」进行设置。',
|
|
|
+ )}
|
|
|
+ style={{ marginBottom: 0 }}
|
|
|
+ />
|
|
|
+ <Button
|
|
|
+ theme='borderless'
|
|
|
+ size='small'
|
|
|
+ type='tertiary'
|
|
|
+ icon={<IconClose aria-hidden={true} />}
|
|
|
+ onClick={confirmCloseMarketplaceDisplayNotice}
|
|
|
+ style={{ position: 'absolute', top: 8, right: 8 }}
|
|
|
+ aria-label={t('关闭')}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ ) : null}
|
|
|
<CardPro
|
|
|
type='type3'
|
|
|
tabsArea={<ModelsTabs {...modelsData} />}
|