sync: 同步 monkey-ai@weiyuan(ddc5b9443) 的 web/ 到 ui-optimization

- 合入 weiyuan 新功能前端:分佣 V2 / 伙伴工作台、智能路由、企业资金与分析、官网设置与预约演示等,
  semi-ui 已全部迁移到 antd 6 / @/components/ui,不重新引入 Semi
- 分佣二级菜单与页头去重、伙伴入口探测(企业伙伴走企业中心「企业分佣」)、超管侧栏入口恢复
- 适配层 DatePicker / TimePicker 统一 onChange(Date|Date[]|null, 文本) 契约;生产构建剔除调试日志
- 图片链接刷新:同任务请求复用、后台刷新不弹全局错误、离页停止批量请求
- 恢复 bun.lock(与 package-lock.json 共存);docs 规范与 CHANGELOG 更新
- 停止跟踪 .env.playwright.local(本地登录凭据,已加入 .gitignore)
This commit is contained in:
qiubaishen
2026-11-18 10:22:02 +08:00
parent dfa5c1edd6
commit a57aae3043
157 changed files with 29960 additions and 1197 deletions
+111
View File
@@ -0,0 +1,111 @@
/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
ConsoleCard,
ConsoleTabs,
} from '../../components/console/ConsolePrimitives';
import ProfileTable from '../../components/smart-router/ProfileTable';
import ConsentPanel from '../../components/smart-router/ConsentPanel';
import DecisionTable from '../../components/smart-router/DecisionTable';
import GlobalSettings from '../../components/smart-router/GlobalSettings';
import { isAdmin, isRoot } from '../../helpers';
import '../../components/smart-router/smart-router.css';
// 智能模型路由控制台页(docs/04-渠道与路由/19-智能模型路由方案.md §十二)。
// 页头、顶栏让位与内边距由 ConsolePageContainer 统一(CONSOLE_SPEC §1),页面不再自绘背景。
const SmartRouterPage = () => {
const { t } = useTranslation();
const admin = isAdmin();
const root = isRoot();
const [tab, setTab] = useState(() => {
try {
return localStorage.getItem('smart_router_tab') || 'mine';
} catch (e) {
return 'mine';
}
});
const onTab = (k) => {
setTab(k);
try {
localStorage.setItem('smart_router_tab', k);
} catch (e) {
/* 浏览器存储不可用时忽略 */
}
};
const tabs = useMemo(() => {
const list = [
{ key: 'mine', title: t('我的集合') },
{ key: 'consent', title: t('数据出境授权') },
{ key: 'decisions', title: t('判定明细') },
];
if (admin) {
list.push({ key: 'system', title: t('平台集合') });
list.push({ key: 'all-decisions', title: t('全部判定明细') });
}
if (root) list.push({ key: 'settings', title: t('全局设置') });
return list;
}, [admin, root, t]);
const activeKey = tabs.some((x) => x.key === tab) ? tab : 'mine';
return (
<div className='smart-router-page'>
<div className='smart-router-hero'>
<div className='smart-router-eyebrow'>{t('Smart Router')}</div>
<h1>{t('智能路由')}</h1>
<p>
{t(
'一个虚拟模型名背后挂多个候选模型,按请求自动选择合适的模型。调用时把模型名写成 router/短名 即可。',
)}
</p>
</div>
<ConsoleCard>
<ConsoleTabs
activeKey={activeKey}
onChange={onTab}
items={tabs.map((x) => ({ key: x.key, label: x.title }))}
/>
<div>
{activeKey === 'mine' && (
<ProfileTable
mode='personal'
emptyHint={t('个人集合只对你自己的令牌和 Playground 生效。')}
/>
)}
{activeKey === 'consent' && <ConsentPanel mode='personal' />}
{activeKey === 'decisions' && <DecisionTable mode='personal' />}
{activeKey === 'system' && (
<ProfileTable
mode='admin'
emptyHint={t(
'平台集合对所有用户可用;修改候选会影响所有引用它的令牌,并写入审计日志。',
)}
/>
)}
{activeKey === 'all-decisions' && <DecisionTable mode='admin' />}
{activeKey === 'settings' && <GlobalSettings />}
</div>
</ConsoleCard>
</div>
);
};
export default SmartRouterPage;