Replace home quick links with AI entries
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
"workflowRunHistory": "执行历史",
|
||||
"aiAgent": "智能体",
|
||||
"knowledgeBase": "知识库",
|
||||
"codex": "Codex",
|
||||
"controlCenter": "控制中心",
|
||||
"applicationManagement": "应用管理",
|
||||
"startChat": "开始聊天",
|
||||
|
||||
@@ -15,6 +15,62 @@ const pageConfig = ref<string>('');
|
||||
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<string, any>) {
|
||||
if (pageCode.value !== 'main_home' || !Array.isArray(config.widgets)) {
|
||||
return config;
|
||||
}
|
||||
|
||||
return {
|
||||
...config,
|
||||
widgets: config.widgets.map((widget: Record<string, any>) => {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user