Merge pull request #2582 from seefs001/fix/tips

fix: add tips for model management and channel testing
This commit is contained in:
Seefs
2026-01-05 18:47:02 +08:00
committed by GitHub
parent cf2eb6da08
commit fa5c585e4e
11 changed files with 147 additions and 19 deletions

View File

@@ -265,6 +265,11 @@ const ModelTestModal = ({
placeholder={t('选择端点类型')}
/>
</div>
<Typography.Text type='tertiary' size='small' className='block mb-2'>
{t(
'说明:本页测试为非流式请求;若渠道仅支持流式返回,可能出现测试失败,请以实际使用为准。',
)}
</Typography.Text>
{/* 搜索与操作按钮 */}
<div className='flex items-center justify-end gap-2 w-full mb-2'>

View File

@@ -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} />}

View File

@@ -31,9 +31,10 @@ import {
Avatar,
Col,
Row,
Tooltip,
} from '@douyinfe/semi-ui';
import { Save, X, FileText } from 'lucide-react';
import { IconLink } from '@douyinfe/semi-icons';
import { IconInfoCircle, IconLink } from '@douyinfe/semi-icons';
import { API, showError, showSuccess } from '../../../../helpers';
import { useTranslation } from 'react-i18next';
import { useIsMobile } from '../../../../hooks/common/useIsMobile';
@@ -447,7 +448,22 @@ const EditModelModal = (props) => {
<Col span={24}>
<JSONEditor
field='endpoints'
label={t('端点映射')}
label={
<span className='inline-flex items-center gap-2'>
<span>{t('端点映射')}</span>
<Tooltip
position='top'
content={t(
'提示:端点映射仅用于模型广场展示,不会影响模型真实调用。如需配置真实调用,请前往「渠道管理」。',
)}
>
<IconInfoCircle
size='small'
className='text-gray-400 cursor-help'
/>
</Tooltip>
</span>
}
placeholder={
'{\n "openai": {"path": "/v1/chat/completions", "method": "POST"}\n}'
}