feat: align lightweight admin with zq platform shell
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user