feat: align lightweight admin with zq platform shell

This commit is contained in:
2026-06-22 05:29:32 +08:00
parent 4ec846a702
commit 1b835a4aad
14 changed files with 280 additions and 41 deletions
+237 -14
View File
@@ -17,12 +17,13 @@ from core.menu.schema import MenuCreate, MenuUpdate
menu_cache = CacheManager(prefix="menu:")
# 缓存key
AI_AGENT_ADMIN_MENU_CACHE_VERSION = "v20"
AI_AGENT_ADMIN_MENU_CACHE_VERSION = "v21"
MENU_TREE_CACHE_KEY = f"tree:ai_agent_admin:{AI_AGENT_ADMIN_MENU_CACHE_VERSION}"
USER_ROUTE_CACHE_PREFIX = f"user_route:ai_agent_admin:{AI_AGENT_ADMIN_MENU_CACHE_VERSION}:"
AI_AGENT_ADMIN_MENU_NAMES = {
"AccountSettings",
"userSettings",
"ControlCenter",
"Application",
"AIPlatform",
@@ -45,6 +46,8 @@ AI_AGENT_ADMIN_MENU_NAMES = {
"SystemPost",
"SystemDict",
"SystemFileManager",
"FileManager",
"SystemTools",
"LoginLog",
"OrgNode",
"SystemLoginLog",
@@ -52,6 +55,7 @@ AI_AGENT_ADMIN_MENU_NAMES = {
"SystemRole",
"SystemConfigManager",
"UIConfigManager",
"userCenter",
"Message",
"MessageList",
"AnnouncementList",
@@ -81,6 +85,8 @@ AI_AGENT_ADMIN_VISIBLE_MENU_NAMES = {
"SystemPost",
"SystemDict",
"SystemFileManager",
"FileManager",
"SystemTools",
"LoginLog",
"OrgNode",
"SystemLoginLog",
@@ -88,6 +94,9 @@ AI_AGENT_ADMIN_VISIBLE_MENU_NAMES = {
"SystemRole",
"SystemConfigManager",
"UIConfigManager",
"userCenter",
"AccountSettings",
"userSettings",
"Message",
"MessageList",
"AnnouncementList",
@@ -100,14 +109,23 @@ AI_AGENT_ADMIN_SYSTEM_CHILD_MENU_NAMES = {
"SystemDept",
"SystemMenu",
"SystemPost",
"SystemRole",
"UIConfigManager",
}
AI_AGENT_ADMIN_SYSTEM_TOOL_CHILD_MENU_NAMES = {
"SystemDict",
"SystemFileManager",
"FileManager",
}
AI_AGENT_ADMIN_USER_CENTER_CHILD_MENU_NAMES = {
"AccountSettings",
"userSettings",
"LoginLog",
"OrgNode",
"SystemLoginLog",
"SystemOrgChart",
"SystemRole",
"UIConfigManager",
}
AI_AGENT_ADMIN_AI_CHILD_MENU_NAMES = {
@@ -132,15 +150,90 @@ AI_AGENT_ADMIN_MONITOR_CHILD_MENU_NAMES = {
}
AI_AGENT_ADMIN_MENU_OVERRIDES = {
"Application": {
"component": "/_core/application/index",
"hideInMenu": False,
"order": 10,
"path": "/application",
"title": "menu-title.applicationManagement",
},
"SystemConfigManager": {
"component": "/_core/system-config/index",
"hideInMenu": False,
"order": 20,
"path": "/system-config",
"title": "system-config.title",
},
"StartChat": {
"component": "/_core/chat/index",
"hideInMenu": False,
"noBasicLayout": True,
"order": 30,
"path": "/chat",
"title": "menu-title.startChat",
},
"AIPlatform": {
"hideInMenu": False,
"order": 40,
"path": "/ai-platform",
"title": "menu-title.aiPlatform",
},
"AIAgent": {
"order": 10,
},
"AIWorkflow": {
"order": 20,
},
"KnowledgeBase": {
"component": "/ai-platform/knowledge/index",
"order": 30,
"path": "/ai-platform/knowledge-base",
},
"AIWorkflowRuns": {
"component": "/ai-platform/workflow-runs/index",
"order": 40,
"path": "/ai-platform/workflow-runs",
},
"AIModelConfig": {
"component": "/ai-platform/model/index",
"order": 50,
"path": "/ai-platform/model",
"title": "system-config.modelConfig",
},
"CodexAgentChat": {
"component": "/_core/agent-chat/index",
"order": 60,
"path": "/agent-chat/codex",
"title": "menu-title.codex",
},
"SystemTools": {
"hideInMenu": False,
"order": 50,
"path": "/tool",
"title": "menu-title.systemTools",
},
"SystemManagement": {
"hideInMenu": False,
"order": 60,
"path": "/core",
"title": "menu-title.systemManagement",
},
"Message": {
"hideInMenu": False,
"order": 70,
"path": "/message",
"title": "menu-title.messageCenter",
},
"userCenter": {
"component": "Layout",
"hideInMenu": False,
"order": 80,
"path": "/user-center",
"title": "menu-title.userCenter",
},
"SystemMonitoring": {
"hideInMenu": False,
"order": 90,
"path": "/monitor",
"title": "menu-title.systemMonitoring",
},
@@ -162,27 +255,49 @@ AI_AGENT_ADMIN_MENU_OVERRIDES = {
"path": "/monitor/database",
"title": "menu-title.databaseMonitoring",
},
"SystemConfigManager": {
"component": "/_core/system-config/index",
"path": "/system-config",
"title": "系统配置",
},
"SystemDict": {
"component": "/_core/dict/index",
"path": "/system/dict",
"path": "/tool/dict",
"title": "menu-title.dictionaryManagement",
},
"SystemFileManager": {
"component": "/_core/file-manager/index",
"path": "/system/file-manager",
"path": "/tool/file",
"title": "menu-title.fileManagement",
},
"FileManager": {
"component": "/_core/file-manager/index",
"path": "/tool/file",
"title": "menu-title.fileManagement",
},
"AccountSettings": {
"component": "/_core/account-settings/index",
"path": "/user-center/",
"title": "menu-title.accountSettings",
},
"userSettings": {
"component": "/_core/account-settings/index",
"path": "/user-center/",
"title": "menu-title.accountSettings",
},
"LoginLog": {
"component": "/_core/login-log/index",
"path": "/system/login-log",
"path": "/log/login-log",
"title": "menu-title.loginLog",
},
"SystemLoginLog": {
"component": "/_core/login-log/index",
"path": "/log/login-log",
"title": "menu-title.loginLog",
},
"OrgNode": {
"component": "/_core/org-chart/index",
"path": "/system/org-chart",
"path": "/user-center/org-node",
"title": "menu-title.orgChart",
},
"SystemOrgChart": {
"component": "/_core/org-chart/index",
"path": "/user-center/org-node",
"title": "menu-title.orgChart",
},
"UIConfigManager": {
@@ -192,6 +307,26 @@ AI_AGENT_ADMIN_MENU_OVERRIDES = {
}
AI_AGENT_ADMIN_SYNTHETIC_MENUS = [
{
"id": "aiadm-application",
"name": "Application",
"title": "menu-title.applicationManagement",
"path": "/application",
"type": "menu",
"component": "/_core/application/index",
"icon": "lucide:app-window",
"order": 10,
},
{
"id": "aiadm-system-conf",
"name": "SystemConfigManager",
"title": "system-config.title",
"path": "/system-config",
"type": "menu",
"component": "/_core/system-config/index",
"icon": "lucide:settings",
"order": 20,
},
{
"id": "aiadm-chat",
"name": "StartChat",
@@ -203,6 +338,80 @@ AI_AGENT_ADMIN_SYNTHETIC_MENUS = [
"order": 20,
"noBasicLayout": True,
},
{
"id": "aiadm-tools",
"name": "SystemTools",
"title": "menu-title.systemTools",
"path": "/tool",
"type": "catalog",
"component": None,
"icon": "carbon:task-tools",
"order": 50,
},
{
"id": "aiadm-dict-menu",
"name": "SystemDict",
"title": "menu-title.dictionaryManagement",
"path": "/tool/dict",
"type": "menu",
"component": "/_core/dict/index",
"icon": "carbon:notebook",
"order": 10,
},
{
"aliases": ("FileManager",),
"id": "aiadm-file-menu",
"name": "SystemFileManager",
"title": "menu-title.fileManagement",
"path": "/tool/file",
"type": "menu",
"component": "/_core/file-manager/index",
"icon": "carbon:ibm-cloud-vpc-file-storage",
"order": 20,
},
{
"id": "aiadm-usercenter",
"name": "userCenter",
"title": "menu-title.userCenter",
"path": "/user-center",
"type": "catalog",
"component": "Layout",
"icon": "carbon:user-avatar",
"order": 80,
},
{
"aliases": ("AccountSettings",),
"id": "aiadm-user-settings",
"name": "userSettings",
"title": "menu-title.accountSettings",
"path": "/user-center/",
"type": "menu",
"component": "/_core/account-settings/index",
"icon": "lucide:settings-2",
"order": 10,
},
{
"aliases": ("SystemLoginLog",),
"id": "aiadm-login-log",
"name": "LoginLog",
"title": "menu-title.loginLog",
"path": "/log/login-log",
"type": "menu",
"component": "/_core/login-log/index",
"icon": "carbon:align-box-middle-center",
"order": 20,
},
{
"aliases": ("SystemOrgChart",),
"id": "aiadm-org-node",
"name": "OrgNode",
"title": "menu-title.orgChart",
"path": "/user-center/org-node",
"type": "menu",
"component": "/_core/org-chart/index",
"icon": "lucide:square-menu",
"order": 30,
},
{
"id": "aiadm-monitor",
"name": "SystemMonitoring",
@@ -211,7 +420,7 @@ AI_AGENT_ADMIN_SYNTHETIC_MENUS = [
"type": "catalog",
"component": None,
"icon": "lucide:activity",
"order": 80,
"order": 90,
},
{
"id": "aiadm-server",
@@ -290,7 +499,7 @@ def _filter_ai_agent_admin_menus(menus: List[Menu]) -> List[Menu]:
filtered.extend(
_make_ai_agent_admin_menu(spec)
for spec in AI_AGENT_ADMIN_SYNTHETIC_MENUS
if spec["name"] not in existing_names
if not ({spec["name"], *spec.get("aliases", ())} & existing_names)
)
for menu in filtered:
_normalize_ai_agent_admin_menu(menu)
@@ -327,6 +536,14 @@ def _normalize_ai_agent_admin_parentage(menus: List[Menu]) -> None:
(menu for menu in menus if menu.name == "Message"),
None,
)
tools_menu = next(
(menu for menu in menus if menu.name == "SystemTools"),
None,
)
user_center_menu = next(
(menu for menu in menus if menu.name == "userCenter"),
None,
)
monitor_menu = next(
(menu for menu in menus if menu.name == "SystemMonitoring"),
None,
@@ -338,6 +555,12 @@ def _normalize_ai_agent_admin_parentage(menus: List[Menu]) -> None:
if ai_menu and menu.name in AI_AGENT_ADMIN_AI_CHILD_MENU_NAMES:
menu.parent_id = ai_menu.id
continue
if tools_menu and menu.name in AI_AGENT_ADMIN_SYSTEM_TOOL_CHILD_MENU_NAMES:
menu.parent_id = tools_menu.id
continue
if user_center_menu and menu.name in AI_AGENT_ADMIN_USER_CENTER_CHILD_MENU_NAMES:
menu.parent_id = user_center_menu.id
continue
if message_menu and menu.name in AI_AGENT_ADMIN_MESSAGE_CHILD_MENU_NAMES:
menu.parent_id = message_menu.id
continue
+1 -1
View File
@@ -51,7 +51,7 @@ services:
args:
VITE_BASE: /ai-agent-admin/
VITE_GLOB_API_URL: /ai-agent-admin/basic-api
VITE_APP_TITLE: ${APP_NAME:-AI Agent Admin}
VITE_APP_TITLE: ${APP_NAME:-Zhi Qing Platform}
image: ai-agent-admin-web:latest
container_name: ${APP_NAME:-ai-agent-admin}-web
restart: unless-stopped
+1 -1
View File
@@ -94,7 +94,7 @@ services:
args:
VITE_BASE: /ai-agent-admin/
VITE_GLOB_API_URL: /ai-agent-admin/basic-api
VITE_APP_TITLE: ${APP_NAME:-AI Agent Admin}
VITE_APP_TITLE: ${APP_NAME:-Zhi Qing Platform}
image: ai-agent-admin-web:latest
container_name: ${APP_NAME:-ai-agent-admin}-web
restart: unless-stopped
+1 -1
View File
@@ -12,7 +12,7 @@ COPY web/ ./
RUN pnpm install --frozen-lockfile
ARG VITE_APP_TITLE=AI Agent Admin
ARG VITE_APP_TITLE=Zhi Qing Platform
ARG VITE_BASE=/ai-agent-admin/
ARG VITE_GLOB_API_URL=/ai-agent-admin/basic-api
+1 -1
View File
@@ -1,7 +1,7 @@
# 端口号
VITE_PORT=5777
VITE_APP_TITLE=AI Agent Admin
VITE_APP_TITLE=Zhi Qing Platform
VITE_BASE=/
+1 -1
View File
@@ -1,4 +1,4 @@
VITE_APP_TITLE=AI Agent Admin
VITE_APP_TITLE=Zhi Qing Platform
VITE_APP_NAMESPACE=ai-agent-admin
VITE_BASE=/ai-agent-admin/
VITE_GLOB_API_URL=/ai-agent-admin/basic-api
@@ -53,6 +53,7 @@
"workflowRunHistory": "Run History",
"aiAgent": "AI Agent",
"knowledgeBase": "Knowledge Base",
"codex": "Codex",
"controlCenter": "Control Center",
"applicationManagement": "App Management",
"startChat": "Start Chat",
@@ -53,6 +53,7 @@
"workflowRunHistory": "执行历史",
"aiAgent": "智能体",
"knowledgeBase": "知识库",
"codex": "Codex",
"controlCenter": "控制中心",
"applicationManagement": "应用管理",
"startChat": "开始聊天",
@@ -53,6 +53,7 @@
"workflowRunHistory": "執行歷史",
"aiAgent": "智能體",
"knowledgeBase": "知識庫",
"codex": "Codex",
"controlCenter": "控制中心",
"applicationManagement": "應用管理",
"startChat": "開始聊天",
+2 -2
View File
@@ -66,7 +66,7 @@ const LIGHT_AI_PLATFORM_MENU_ROUTES = [
meta: {
fullPathKey: true,
icon: 'lucide:code',
order: 25,
order: 60,
title: 'menu-title.codex',
},
name: 'CodexAgentChat',
@@ -77,7 +77,7 @@ const LIGHT_AI_PLATFORM_MENU_ROUTES = [
meta: {
fullPathKey: true,
icon: 'lucide:settings',
order: 30,
order: 50,
title: 'menu-title.modelConfig',
},
name: 'AIModelConfig',
@@ -11,6 +11,7 @@ export const LIGHT_MENU_NAMES = new Set([
'AnnouncementList',
'AnnouncementManage',
'CodexAgentChat',
'FileManager',
'Message',
'MessageCenter',
'MessageList',
@@ -27,6 +28,7 @@ export const LIGHT_MENU_NAMES = new Set([
'SystemLoginLog',
'SystemManagement',
'SystemOrgChart',
'SystemTools',
'SystemConfig',
'SystemConfigManager',
'SystemMonitoring',
@@ -37,6 +39,8 @@ export const LIGHT_MENU_NAMES = new Set([
'UIConfig',
'UIConfigManager',
'UserManagement',
'userCenter',
'userSettings',
]);
const LIGHT_ROUTE_PATH_PREFIXES = [
@@ -70,6 +74,8 @@ const LIGHT_ROUTE_PATH_PREFIXES = [
'/system/ui-config',
'/system/user',
'/tool/dict',
'/tool/file',
'/log/login-log',
'/user-center',
];
@@ -31,20 +31,6 @@ const aiHomeMenus = [
path: '/ai-platform/workflow',
title: '流程编排',
},
{
color: 'rgba(124, 58, 237, 0.85)',
icon: 'lucide:history',
id: 'ai-workflow-runs',
path: '/ai-platform/workflow-runs',
title: '执行历史',
},
{
color: 'rgba(249, 115, 22, 0.85)',
icon: 'lucide:message-square-code',
id: 'codex-chat',
path: '/agent-chat/codex',
title: 'Codex',
},
{
color: 'rgba(15, 118, 110, 0.85)',
icon: 'lucide:database',
@@ -52,6 +38,13 @@ const aiHomeMenus = [
path: '/ai-platform/knowledge-base',
title: '知识库',
},
{
color: 'rgba(124, 58, 237, 0.85)',
icon: 'lucide:history',
id: 'ai-workflow-runs',
path: '/ai-platform/workflow-runs',
title: '执行历史',
},
{
color: 'rgba(71, 85, 105, 0.85)',
icon: 'lucide:settings',
@@ -59,6 +52,13 @@ const aiHomeMenus = [
path: '/ai-platform/model',
title: '模型配置',
},
{
color: 'rgba(249, 115, 22, 0.85)',
icon: 'lucide:message-square-code',
id: 'codex-chat',
path: '/agent-chat/codex',
title: 'Codex',
},
];
const adminHomeMenus = [
@@ -181,27 +181,34 @@ function getLightMainHomeConfig(config: Record<string, any>) {
const next = JSON.parse(JSON.stringify(config));
if (!Array.isArray(next.widgets)) return next;
const hasApprovalCenter = next.widgets.some(
(widget: any) => widget.type === 'approval-center',
);
next.widgets = next.widgets.map((widget: any) => {
if (widget.type === 'welcome-card') {
return {
...widget,
props: {
...widget.props,
subtitle: '聚焦智能体协作、流程编排和基础权限治理',
title: '欢迎回来',
subtitle: '今天是个好日子',
title: widget.props?.title || '欢迎回来',
},
};
}
if (widget.type === 'approval-center') {
return toApprovalCenterWidget(widget, 'AI 协作中心', aiHomeMenus);
return toApprovalCenterWidget(widget, '审批中心', aiHomeMenus);
}
if (widget.type === 'my-apps') {
return toStaticAppsWidget(widget, '基础管理', adminHomeMenus);
return toStaticAppsWidget(widget, '我的应用', adminHomeMenus);
}
if (widget.type === 'quick-links') {
if (!hasApprovalCenter && widget.props?.title === 'AI 协作') {
return toApprovalCenterWidget(widget, '审批中心', aiHomeMenus);
}
return toQuickLinksWidget(widget, '快捷入口', opsHomeMenus);
}
+1 -1
View File
@@ -93,7 +93,7 @@ async function loadAndConvertEnv(
.filter((item) => item === 'brotli' || item === 'gzip');
return {
appTitle: getString(VITE_APP_TITLE, 'AI Agent Admin'),
appTitle: getString(VITE_APP_TITLE, 'Zhi Qing Platform'),
archiver: getBoolean(VITE_ARCHIVER),
base: getString(VITE_BASE, '/'),
compress: compressTypes.length > 0,
+1 -1
View File
@@ -27,7 +27,7 @@ const defaultPreferences: Preferences = {
layout: 'sidebar-nav',
locale: 'zh-CN',
loginExpiredMode: 'page',
name: 'AI Agent Admin',
name: 'Zhi Qing Platform',
preferencesButtonPosition: 'auto',
watermark: false,
watermarkContent: '',