From 202a181ebe76f98ef3f68f2823c57272e92ba0bd Mon Sep 17 00:00:00 2001 From: QihuAI Design Date: Tue, 14 Jul 2026 12:11:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=A1=B5=E9=9D=A2=E6=AD=A3?= =?UTF-8?q?=E6=96=87=E6=A0=87=E9=A2=98=E6=94=B9=E5=90=8D=EF=BC=9A=E4=BB=98?= =?UTF-8?q?=E8=B4=B9=E4=B8=AD=E5=BF=83=E2=86=92=E4=BC=9A=E5=91=98=E8=AE=A2?= =?UTF-8?q?=E9=98=85=E3=80=81=E5=BE=AE=E4=BF=A1=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E2=86=92=E5=BE=AE=E4=BF=A1Bot=E3=80=81=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E2=86=92=E4=BC=9A=E5=91=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=80=81=E5=BA=94=E7=94=A8=E5=B8=82=E5=9C=BA=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E2=86=92AI=E6=8A=80=E8=83=BD=E5=AE=A1=E6=A0=B8=E3=80=81?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E7=AE=A1=E7=90=86=E2=86=92Skills=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E7=AE=A1=E7=90=86=E3=80=81MCP=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E2=86=92MCP=20Client=E7=AE=A1=E7=90=86=E3=80=81=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=B8=A0=E9=81=93=E9=85=8D=E7=BD=AE=E2=86=92=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E6=B8=A0=E9=81=93=E3=80=81=E5=B9=BF=E5=91=8A=E4=BD=8D?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E2=86=92=E5=B9=BF=E5=91=8A=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/layout/AdminLayout.tsx | 852 +++++------ frontend/src/pages/admin/Ads.tsx | 2 +- frontend/src/pages/admin/Market.tsx | 2 +- frontend/src/pages/admin/Mcp.tsx | 810 +++++----- frontend/src/pages/admin/Membership.tsx | 2 +- frontend/src/pages/admin/Payment.tsx | 2 +- frontend/src/pages/admin/PrivacySettings.tsx | 4 +- frontend/src/pages/admin/Skills.tsx | 1330 ++++++++--------- frontend/src/pages/front/LandingPage.tsx | 4 +- frontend/src/pages/front/PricingPage.tsx | 2 +- frontend/src/pages/front/WechatBot.tsx | 2 +- frontend/src/pages/front/WechatHistory.tsx | 2 +- 12 files changed, 1507 insertions(+), 1507 deletions(-) diff --git a/frontend/src/components/layout/AdminLayout.tsx b/frontend/src/components/layout/AdminLayout.tsx index 7c1ce3c..e747eb4 100644 --- a/frontend/src/components/layout/AdminLayout.tsx +++ b/frontend/src/components/layout/AdminLayout.tsx @@ -1,426 +1,426 @@ -import React, { useState, useEffect } from 'react'; - -import { Outlet, NavLink, useNavigate, useLocation } from 'react-router-dom'; - -import { useAuth } from '@/contexts/AuthContext'; - -import './AdminLayout.css'; - - - -interface NavItem { - - path: string; - - icon: string; - - label: string; - - exact?: boolean; - -} - - - -interface NavGroup { - - title: string; - - icon: string; - - items: NavItem[]; - -} - - - -const adminNavGroups: NavGroup[] = [ - - { - title: '数据驾驶舱', - icon: 'dashboard', - items: [ - { path: '/admin', icon: 'dashboard', label: '平台驾驶舱', exact: true }, - { path: '/admin/analytics', icon: 'analytics', label: '数据分析' }, - ], - }, - - { - title: 'AI技能中心', - icon: 'agents', - items: [ - { path: '/admin/models', icon: 'models', label: '大模型库' }, - { path: '/admin/agents', icon: 'agents', label: 'Agent 管理' }, - { path: '/admin/skills', icon: 'skills', label: 'Skills 技能管理' }, - { path: '/admin/mcp', icon: 'mcp', label: 'MCP Client 管理' }, - { path: '/admin/market', icon: 'market', label: 'AI 技能审核' }, - ], - }, - - { - title: '平台运营', - icon: 'users', - items: [ - { path: '/admin/users', icon: 'users', label: '用户管理' }, - { path: '/admin/membership', icon: 'membership', label: '会员管理' }, - { path: '/admin/promotion', icon: 'promotion', label: '推广系统' }, - { path: '/admin/achievement', icon: 'achievement', label: '成就系统' }, - ], - }, - - { - title: '商业变现', - icon: 'billing', - items: [ - { path: '/admin/billing', icon: 'billing', label: '计费与支付' }, - { path: '/admin/payment', icon: 'payment', label: '支付渠道' }, - { path: '/admin/services', icon: 'services', label: '增值服务' }, - { path: '/admin/ads', icon: 'ads', label: '广告管理' }, - { path: '/admin/assets', icon: 'assets', label: '资产管理' }, - ], - }, - - { - title: '系统管理', - icon: 'settings', - items: [ - { path: '/admin/settings', icon: 'settings', label: '网站设置' }, - { path: '/admin/logs', icon: 'logs', label: '日志与风控' }, - ], - }, - - { - title: '待处理', - icon: 'developer', - items: [ - { path: '/admin/knowledge', icon: 'knowledge', label: '知识库管理' }, - { path: '/admin/workflow', icon: 'workflow', label: '工作流编排' }, - { path: '/admin/apps', icon: 'apps', label: 'AI 应用管理' }, - { path: '/admin/code-exec', icon: 'code', label: '代码执行沙箱' }, - { path: '/admin/tenant', icon: 'tenant', label: '多租户管理' }, - { path: '/admin/sms', icon: 'sms', label: '短信配置' }, - { path: '/admin/im-bots', icon: 'imbot', label: 'IM 机器人' }, - { path: '/admin/privacy', icon: 'privacy', label: '隐私与本地代理' }, - { path: '/admin/distributions', icon: 'distro', label: '发行版构建' }, - { path: '/admin/storage', icon: 'storage', label: '存储配置' }, - { path: '/admin/automation', icon: 'automation', label: '自动化任务' }, - { path: '/admin/developer', icon: 'developer', label: '开发者 API' }, - { path: '/admin/developer-tools', icon: 'devtools', label: '开发者工具' }, - ], - }, - -]; - - - -const adminIconPaths: Record = { - - dashboard: , - - users: , - - models: , - - settings: , - - payment: , - - services: , - - membership: , - - ads: , - - market: , - - logs: , - - agents: , - - skills: , - - code: , - - distro: , - - privacy: , - - promotion: , - - achievement: , - - tenant: , - - billing: , - - analytics: , - - imbot: , - - storage: , - - automation: , - - developer: , - - devtools: , - - knowledge: , - - workflow: , - - mcp: , - - apps: , - - assets: , - - chevron: , - - sms: , - -}; - - - -const AdminLayout: React.FC = () => { - - const { user, logout } = useAuth(); - - const navigate = useNavigate(); - - const location = useLocation(); - - const navCrumb = (() => { - - for (const g of adminNavGroups) { - - for (const it of g.items) { - - const match = it.exact - - ? location.pathname === it.path - - : location.pathname === it.path || location.pathname.startsWith(it.path + '/'); - - if (match) return { group: g.title, label: it.label }; - - } - - } - - return { group: '', label: '' }; - - })(); - - const navGroup = navCrumb.group; - - const navLabel = navCrumb.label; - - - - // 默认展开全部功能板块,确保后台所有模块在 UI 中可见(DESIGN.md: 侧栏分类清晰) - const [expandedGroups, setExpandedGroups] = useState>(() => { - return new Set(adminNavGroups.map((g) => g.title)); - }); - - - - const toggleGroup = (title: string) => { - - setExpandedGroups(prev => { - - const next = new Set(prev); - - if (next.has(title)) next.delete(title); - - else next.add(title); - - return next; - - }); - - }; - - - - const handleLogout = () => { - - logout(); - - navigate('/'); - - }; - - - - const handleVisitFrontend = () => { - - const url = window.location.origin + '/chat'; - - window.open(url, '_blank'); - - }; - - - - return ( - -
- - - -
- -
- - - -
- -
{user?.username?.[0]?.toUpperCase() || 'A'}
- - {user?.username || 'admin'} - -
- -
- - - -
- -
- - ); - -}; - - - -export default AdminLayout; - +import React, { useState, useEffect } from 'react'; + +import { Outlet, NavLink, useNavigate, useLocation } from 'react-router-dom'; + +import { useAuth } from '@/contexts/AuthContext'; + +import './AdminLayout.css'; + + + +interface NavItem { + + path: string; + + icon: string; + + label: string; + + exact?: boolean; + +} + + + +interface NavGroup { + + title: string; + + icon: string; + + items: NavItem[]; + +} + + + +const adminNavGroups: NavGroup[] = [ + + { + title: '数据驾驶舱', + icon: 'dashboard', + items: [ + { path: '/admin', icon: 'dashboard', label: '平台驾驶舱', exact: true }, + { path: '/admin/analytics', icon: 'analytics', label: '数据分析' }, + ], + }, + + { + title: 'AI技能中心', + icon: 'agents', + items: [ + { path: '/admin/models', icon: 'models', label: '大模型库' }, + { path: '/admin/agents', icon: 'agents', label: 'Agent 管理' }, + { path: '/admin/skills', icon: 'skills', label: 'Skills技能管理' }, + { path: '/admin/mcp', icon: 'mcp', label: 'MCP Client 管理' }, + { path: '/admin/market', icon: 'market', label: 'AI 技能审核' }, + ], + }, + + { + title: '平台运营', + icon: 'users', + items: [ + { path: '/admin/users', icon: 'users', label: '用户管理' }, + { path: '/admin/membership', icon: 'membership', label: '会员管理' }, + { path: '/admin/promotion', icon: 'promotion', label: '推广系统' }, + { path: '/admin/achievement', icon: 'achievement', label: '成就系统' }, + ], + }, + + { + title: '商业变现', + icon: 'billing', + items: [ + { path: '/admin/billing', icon: 'billing', label: '计费与支付' }, + { path: '/admin/payment', icon: 'payment', label: '支付渠道' }, + { path: '/admin/services', icon: 'services', label: '增值服务' }, + { path: '/admin/ads', icon: 'ads', label: '广告管理' }, + { path: '/admin/assets', icon: 'assets', label: '资产管理' }, + ], + }, + + { + title: '系统管理', + icon: 'settings', + items: [ + { path: '/admin/settings', icon: 'settings', label: '网站设置' }, + { path: '/admin/logs', icon: 'logs', label: '日志与风控' }, + ], + }, + + { + title: '待处理', + icon: 'developer', + items: [ + { path: '/admin/knowledge', icon: 'knowledge', label: '知识库管理' }, + { path: '/admin/workflow', icon: 'workflow', label: '工作流编排' }, + { path: '/admin/apps', icon: 'apps', label: 'AI 应用管理' }, + { path: '/admin/code-exec', icon: 'code', label: '代码执行沙箱' }, + { path: '/admin/tenant', icon: 'tenant', label: '多租户管理' }, + { path: '/admin/sms', icon: 'sms', label: '短信配置' }, + { path: '/admin/im-bots', icon: 'imbot', label: 'IM 机器人' }, + { path: '/admin/privacy', icon: 'privacy', label: '隐私与本地代理' }, + { path: '/admin/distributions', icon: 'distro', label: '发行版构建' }, + { path: '/admin/storage', icon: 'storage', label: '存储配置' }, + { path: '/admin/automation', icon: 'automation', label: '自动化任务' }, + { path: '/admin/developer', icon: 'developer', label: '开发者 API' }, + { path: '/admin/developer-tools', icon: 'devtools', label: '开发者工具' }, + ], + }, + +]; + + + +const adminIconPaths: Record = { + + dashboard: , + + users: , + + models: , + + settings: , + + payment: , + + services: , + + membership: , + + ads: , + + market: , + + logs: , + + agents: , + + skills: , + + code: , + + distro: , + + privacy: , + + promotion: , + + achievement: , + + tenant: , + + billing: , + + analytics: , + + imbot: , + + storage: , + + automation: , + + developer: , + + devtools: , + + knowledge: , + + workflow: , + + mcp: , + + apps: , + + assets: , + + chevron: , + + sms: , + +}; + + + +const AdminLayout: React.FC = () => { + + const { user, logout } = useAuth(); + + const navigate = useNavigate(); + + const location = useLocation(); + + const navCrumb = (() => { + + for (const g of adminNavGroups) { + + for (const it of g.items) { + + const match = it.exact + + ? location.pathname === it.path + + : location.pathname === it.path || location.pathname.startsWith(it.path + '/'); + + if (match) return { group: g.title, label: it.label }; + + } + + } + + return { group: '', label: '' }; + + })(); + + const navGroup = navCrumb.group; + + const navLabel = navCrumb.label; + + + + // 默认展开全部功能板块,确保后台所有模块在 UI 中可见(DESIGN.md: 侧栏分类清晰) + const [expandedGroups, setExpandedGroups] = useState>(() => { + return new Set(adminNavGroups.map((g) => g.title)); + }); + + + + const toggleGroup = (title: string) => { + + setExpandedGroups(prev => { + + const next = new Set(prev); + + if (next.has(title)) next.delete(title); + + else next.add(title); + + return next; + + }); + + }; + + + + const handleLogout = () => { + + logout(); + + navigate('/'); + + }; + + + + const handleVisitFrontend = () => { + + const url = window.location.origin + '/chat'; + + window.open(url, '_blank'); + + }; + + + + return ( + +
+ + + +
+ +
+ + + +
+ +
{user?.username?.[0]?.toUpperCase() || 'A'}
+ + {user?.username || 'admin'} + +
+ +
+ + + +
+ +
+ + ); + +}; + + + +export default AdminLayout; + diff --git a/frontend/src/pages/admin/Ads.tsx b/frontend/src/pages/admin/Ads.tsx index e25864d..b8f1bed 100644 --- a/frontend/src/pages/admin/Ads.tsx +++ b/frontend/src/pages/admin/Ads.tsx @@ -204,7 +204,7 @@ const Ads: React.FC = () => { return (
-

广告位管理

+

广告管理

- 第 {page} / {totalPages} 页 - -
- )} - - {showModal && setShowModal(false)} />} -
- ); -} - -function McpModal({ server, onSubmit, onClose }: { server: MCPServer | null; onSubmit: (data: any) => void; onClose: () => void }) { - const [form, setForm] = useState({ - name: server?.name || '', - description: server?.description || '', - transport_type: server?.transport_type || 'stdio', - command: server?.command || '', - args: server?.args ? JSON.stringify(server.args, null, 2) : '', - env_vars: server?.env_vars ? JSON.stringify(server.env_vars, null, 2) : '', - url: server?.url || '', - headers: server?.headers ? JSON.stringify(server.headers, null, 2) : '', - }); - - const handleChange = (field: string, value: string) => { - setForm(prev => ({ ...prev, [field]: value })); - }; - - const handleSubmit = (e: React.FormEvent) => { - e.preventDefault(); - const data: any = { - name: form.name, - description: form.description, - transport_type: form.transport_type, - }; - - if (form.transport_type === 'stdio') { - data.command = form.command; - try { data.args = form.args ? JSON.parse(form.args) : {}; } catch { data.args = {}; } - try { data.env_vars = form.env_vars ? JSON.parse(form.env_vars) : {}; } catch { data.env_vars = {}; } - } else { - data.url = form.url; - try { data.headers = form.headers ? JSON.parse(form.headers) : {}; } catch { data.headers = {}; } - } - - onSubmit(data); - }; - - return ( -
-
e.stopPropagation()}> -
{server ? '编辑 MCP 服务' : '添加 MCP 服务'}
-
-
- - handleChange('name', e.target.value)} required placeholder="例如:文件系统服务" /> -
-
- -