From e3352bf04c24c0bb9321f02be5ae7bf76f0e9371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cls=5F=E5=AE=81=E6=B3=A2=E6=9C=AC=E6=9C=BA?= <908705107@qq.com> Date: Wed, 10 Jun 2026 20:10:54 +0800 Subject: [PATCH] Replace home quick links with AI entries --- backend-fastapi/db_init.json | 77 +++++++++++++++++-- .../src/locales/langs/zh-CN/menu-title.json | 1 + .../views/online-dev/page-render/index.vue | 63 ++++++++++++++- 3 files changed, 131 insertions(+), 10 deletions(-) diff --git a/backend-fastapi/db_init.json b/backend-fastapi/db_init.json index d1d6864..e5a05f5 100644 --- a/backend-fastapi/db_init.json +++ b/backend-fastapi/db_init.json @@ -7883,6 +7883,51 @@ "sys_dept_id": null } }, + { + "model": "core.menu.model.Menu", + "pk": "aiadm-codex", + "fields": { + "application_id": null, + "is_system": true, + "parent_id": "4CW_HY32ozaVOQpSz7njE", + "name": "Codex", + "title": "menu-title.codex", + "authCode": null, + "path": "/agent-chat/codex", + "type": "menu", + "component": "/_core/agent-chat/index", + "redirect": null, + "activePath": null, + "query": null, + "noBasicLayout": false, + "icon": "lucide:code", + "activeIcon": null, + "order": 50, + "hideInMenu": false, + "hideChildrenInMenu": false, + "hideInBreadcrumb": false, + "hideInTab": false, + "affixTab": false, + "affixTabOrder": null, + "keepAlive": false, + "maxNumOfOpenTab": null, + "fullPathKey": true, + "link": null, + "iframeSrc": null, + "openInNewWindow": false, + "badge": null, + "badgeType": null, + "badgeVariants": null, + "id": "aiadm-codex", + "sort": 50, + "is_deleted": false, + "sys_create_datetime": "2026-06-01T12:00:00.000000", + "sys_update_datetime": "2026-06-01T12:00:00.000000", + "sys_creator_id": null, + "sys_modifier_id": null, + "sys_dept_id": null + } + }, { "model": "core.menu.model.Menu", "pk": "iGGhzrgeACiioTy0PF-CU", @@ -14125,15 +14170,33 @@ "rows": 2, "menus": [ { - "id": "mWJtvLYnAMa_3fR_jjtBc", - "title": "应用管理", - "icon": "lucide:app-window", - "path": "/application", + "id": "ai-agent", + "title": "智能体", + "icon": "lucide:square-user", + "path": "/ai-platform/agent", + "bgColor": "" + }, + { + "id": "ai-workflow", + "title": "流程编排", + "icon": "lucide:workflow", + "path": "/ai-platform/workflow", + "bgColor": "" + }, + { + "id": "ai-knowledge", + "title": "知识库", + "icon": "lucide:library-big", + "path": "/ai-platform/knowledge-base", + "bgColor": "" + }, + { + "id": "codex", + "title": "Codex", + "icon": "lucide:code", + "path": "/agent-chat/codex", "bgColor": "" }, - null, - null, - null, null, null, null, diff --git a/web/apps/web-ele/src/locales/langs/zh-CN/menu-title.json b/web/apps/web-ele/src/locales/langs/zh-CN/menu-title.json index 26fa260..628ad1c 100644 --- a/web/apps/web-ele/src/locales/langs/zh-CN/menu-title.json +++ b/web/apps/web-ele/src/locales/langs/zh-CN/menu-title.json @@ -54,6 +54,7 @@ "workflowRunHistory": "执行历史", "aiAgent": "智能体", "knowledgeBase": "知识库", + "codex": "Codex", "controlCenter": "控制中心", "applicationManagement": "应用管理", "startChat": "开始聊天", diff --git a/web/apps/web-ele/src/views/online-dev/page-render/index.vue b/web/apps/web-ele/src/views/online-dev/page-render/index.vue index 6420d28..d10a60d 100644 --- a/web/apps/web-ele/src/views/online-dev/page-render/index.vue +++ b/web/apps/web-ele/src/views/online-dev/page-render/index.vue @@ -15,6 +15,62 @@ const pageConfig = ref(''); const pageName = ref(''); const pageCode = ref(''); +const MAIN_HOME_AI_LINKS = [ + { + bgColor: '', + icon: 'lucide:square-user', + id: 'ai-agent', + path: '/ai-platform/agent', + title: '智能体', + }, + { + bgColor: '', + icon: 'lucide:workflow', + id: 'ai-workflow', + path: '/ai-platform/workflow', + title: '流程编排', + }, + { + bgColor: '', + icon: 'lucide:library-big', + id: 'ai-knowledge', + path: '/ai-platform/knowledge-base', + title: '知识库', + }, + { + bgColor: '', + icon: 'lucide:code', + id: 'codex', + path: '/agent-chat/codex', + title: 'Codex', + }, + null, + null, + null, + null, +]; + +function normalizeMainHomeConfig(config: Record) { + if (pageCode.value !== 'main_home' || !Array.isArray(config.widgets)) { + return config; + } + + return { + ...config, + widgets: config.widgets.map((widget: Record) => { + if (widget.type !== 'quick-links') return widget; + + return { + ...widget, + props: { + ...widget.props, + menus: MAIN_HOME_AI_LINKS, + }, + }; + }), + }; +} + // 获取页面编码 function getPageCode(): string { // 优先从 query 获取 @@ -51,10 +107,11 @@ async function loadPageData() { try { const page = await getPageByCodeApi(code); pageName.value = page.name; - pageConfig.value = + const config = page.page_config && Object.keys(page.page_config).length > 0 - ? JSON.stringify(page.page_config) - : ''; + ? normalizeMainHomeConfig(page.page_config) + : null; + pageConfig.value = config ? JSON.stringify(config) : ''; } catch (error: any) { ElMessage.error(error?.message || '加载页面失败'); } finally {