Merge branch 'dhk-1' of http://192.168.0.200/knowledge-base-bj/deerflow-server into dhk-1
This commit is contained in:
commit
1214ea0d91
1 file changed
+308
-322
@@ -1,322 +1,308 @@
|
|||||||
/**
|
/**
|
||||||
* 全局侧边栏菜单数据与权限过滤逻辑。
|
* 全局侧边栏菜单数据与权限过滤逻辑。
|
||||||
*
|
*
|
||||||
* 浅色 PageSidebar 和深色 PageSidebarDark 共用这份数据,菜单结构与
|
* 浅色 ``PageSidebar`` 和深色 ``PageSidebarDark`` 共用这份数据 —— 菜单结构与
|
||||||
* adminOnly 权限策略对两种皮肤一致;UI 渲染在各自组件里实现。
|
* adminOnly 权限策略对两种皮肤完全一致;UI 渲染(icon 显示/折叠样式/hover flyout)
|
||||||
*
|
* 在各自组件里实现。
|
||||||
* 修改菜单只需要改这一处,两个 sidebar 自动同步。
|
*
|
||||||
*/
|
* 修改菜单只需改这一处,两个 sidebar 自动同步。
|
||||||
import type { ElementType } from "react";
|
*/
|
||||||
import {
|
import type { ElementType } from "react";
|
||||||
BookOpen,
|
import {
|
||||||
Bot,
|
BookOpen,
|
||||||
Brain,
|
Bot,
|
||||||
CalendarClock,
|
Brain,
|
||||||
CircleHelp,
|
CalendarClock,
|
||||||
Database,
|
CircleHelp,
|
||||||
FileBox,
|
Database,
|
||||||
FileText,
|
FileBox,
|
||||||
Folder,
|
FileText,
|
||||||
Gauge,
|
Folder,
|
||||||
Grid3X3,
|
Gauge,
|
||||||
HelpCircle,
|
Grid3X3,
|
||||||
History,
|
HelpCircle,
|
||||||
Layers,
|
History,
|
||||||
Layout,
|
Layers,
|
||||||
List,
|
Layout,
|
||||||
ListChecks,
|
Library,
|
||||||
ListTodo,
|
List,
|
||||||
MessageSquareCode,
|
ListChecks,
|
||||||
Network,
|
ListTodo,
|
||||||
NotebookPen,
|
Network,
|
||||||
Plus,
|
Settings,
|
||||||
Settings,
|
Sparkles,
|
||||||
Sparkles,
|
Target,
|
||||||
Target,
|
Trophy,
|
||||||
Trophy,
|
Users,
|
||||||
Users,
|
} from "lucide-react";
|
||||||
} from "lucide-react";
|
|
||||||
|
export type MenuItem = {
|
||||||
export type MenuItem = {
|
id: string;
|
||||||
id: string;
|
label: string;
|
||||||
label: string;
|
icon: ElementType;
|
||||||
icon: ElementType;
|
path?: string;
|
||||||
path?: string;
|
adminOnly?: boolean;
|
||||||
adminOnly?: boolean;
|
children?: MenuItem[];
|
||||||
children?: MenuItem[];
|
};
|
||||||
};
|
|
||||||
|
export const sidebarMenuItems: MenuItem[] = [
|
||||||
export const sidebarMenuItems: MenuItem[] = [
|
{
|
||||||
{
|
id: "qa-center",
|
||||||
id: "qa-center",
|
label: "问答中心",
|
||||||
label: "问答中心",
|
icon: HelpCircle,
|
||||||
icon: HelpCircle,
|
children: [
|
||||||
children: [
|
{ id: "general-qa", label: "通用问答", icon: CircleHelp, path: "/page/workspace/chats/new" },
|
||||||
{ id: "general-qa", label: "通用问答", icon: CircleHelp, path: "/page/workspace/chats/new" },
|
{
|
||||||
{
|
id: "multi-agent-roundtable",
|
||||||
id: "multi-agent-roundtable",
|
label: "多智能体会商",
|
||||||
label: "多智能体会商",
|
icon: Users,
|
||||||
icon: Users,
|
path: "/page/strategy/qa/multi-agent-roundtable",
|
||||||
path: "/page/strategy/qa/multi-agent-roundtable",
|
},
|
||||||
},
|
// { id: "expert-qa", label: "专家问答", icon: Brain, path: "/page/strategy/qa/expert-qa" },
|
||||||
// { id: "expert-qa", label: "专家问答", icon: Brain, path: "/page/strategy/qa/expert-qa" },
|
{
|
||||||
{
|
id: "qa-zzjc",
|
||||||
id: "qa-zzjc",
|
label: "zzJC支持",
|
||||||
label: "zzJC支持",
|
icon: Bot,
|
||||||
icon: Bot,
|
path: "/page/strategy/agents/6bf/chats/new",
|
||||||
path: "/page/strategy/agents/6bf/chats/new",
|
},
|
||||||
},
|
{ id: "qa-zzxd", label: "zzXD应用", icon: Layout, path: "/page/strategy/agents/10d69686718349688e58a8790cb61024/chats/new", },
|
||||||
{
|
{ id: "qa-research", label: "课题研究", icon: FileText, path: "/page/canvas/ai-writing" },
|
||||||
id: "qa-zzxd",
|
],
|
||||||
label: "zzXD应用",
|
},
|
||||||
icon: Layout,
|
{
|
||||||
path: "/page/strategy/agents/10d69686718349688e58a8790cb61024/chats/new",
|
id: "task-management",
|
||||||
},
|
label: "任务管理",
|
||||||
{ id: "qa-research", label: "课题研究", icon: FileText, path: "/page/canvas/ai-writing" },
|
icon: Target,
|
||||||
],
|
children: [
|
||||||
},
|
{
|
||||||
// {
|
id: "xk-center-task",
|
||||||
// id: "light-app-center",
|
label: "XK中任务",
|
||||||
// label: "应用中心",
|
icon: Folder,
|
||||||
// icon: Grid3X3,
|
children: [
|
||||||
// children: [
|
{
|
||||||
// {
|
id: "xk-task-jc",
|
||||||
// id: "light-app-note-management",
|
label: "任务JC",
|
||||||
// label: "笔记管理",
|
icon: ListTodo,
|
||||||
// icon: NotebookPen,
|
path: "/page/strategy/task-management/xk-task-jc",
|
||||||
// children: [
|
},
|
||||||
// {
|
{
|
||||||
// id: "light-app-new-note",
|
id: "xk-task-dispatch",
|
||||||
// label: "新建笔记",
|
label: "任务调度",
|
||||||
// icon: Plus,
|
icon: ListTodo,
|
||||||
// path: "/page/strategy/light-app/new-note",
|
path: "/page/strategy/task-management/xk-task-dispatch",
|
||||||
// },
|
},
|
||||||
// {
|
],
|
||||||
// id: "light-app-note-list",
|
},
|
||||||
// label: "笔记列表",
|
{
|
||||||
// icon: List,
|
id: "coh-center-task",
|
||||||
// path: "/page/strategy/light-app/notes",
|
label: "COH中任务",
|
||||||
// },
|
icon: Folder,
|
||||||
// {
|
children: [
|
||||||
// id: "light-app-note-qa",
|
{
|
||||||
// label: "笔记问答",
|
id: "coh-task-3qfx",
|
||||||
// icon: MessageSquareCode,
|
label: "3QFX",
|
||||||
// path: "/page/strategy/light-app/note-qa",
|
icon: ListTodo,
|
||||||
// },
|
path: "/page/strategy/task-management/plan-task-sentiment",
|
||||||
// ],
|
},
|
||||||
// },
|
{
|
||||||
// { id: "light-app-square", label: "应用广场", icon: Layout },
|
id: "coh-task-fx",
|
||||||
// { id: "light-app-records", label: "使用记录", icon: History },
|
label: "任务FX",
|
||||||
// ],
|
icon: ListTodo,
|
||||||
// },
|
path: "/page/strategy/task-management/plan-task/plan-task-fx",
|
||||||
{
|
},
|
||||||
id: "task-management",
|
{
|
||||||
label: "任务管理",
|
id: "coh-task-xdfx",
|
||||||
icon: Target,
|
label: "XDFX",
|
||||||
children: [
|
icon: ListTodo,
|
||||||
{
|
path: "/page/strategy/task-management/plan-task/plan-task-action",
|
||||||
id: "xk-center-task",
|
},
|
||||||
label: "XK中任务",
|
],
|
||||||
icon: Folder,
|
},
|
||||||
children: [
|
{
|
||||||
{
|
id: "pg-center-task",
|
||||||
id: "xk-task-jc",
|
label: "PG中任务",
|
||||||
label: "任务JC",
|
icon: Folder,
|
||||||
icon: ListTodo,
|
children: [
|
||||||
path: "/page/strategy/task-management/xk-task-jc",
|
{
|
||||||
},
|
id: "pg-task-pg",
|
||||||
{
|
label: "任务PG",
|
||||||
id: "xk-task-dispatch",
|
icon: ListTodo,
|
||||||
label: "任务调度",
|
path: "/page/strategy/task-management/effect-task-pg",
|
||||||
icon: ListTodo,
|
},
|
||||||
path: "/page/strategy/task-management/xk-task-dispatch",
|
{
|
||||||
},
|
id: "pg-task-xdpg",
|
||||||
],
|
label: "XDPG",
|
||||||
},
|
icon: ListTodo,
|
||||||
{
|
path: "/page/strategy/task-management/effect-action-pg",
|
||||||
id: "coh-center-task",
|
},
|
||||||
label: "COH中任务",
|
{
|
||||||
icon: Folder,
|
id: "pg-task-info-pg",
|
||||||
children: [
|
label: "信息PG",
|
||||||
{
|
icon: ListTodo,
|
||||||
id: "coh-task-3qfx",
|
path: "/page/strategy/task-management/effect-info-pg",
|
||||||
label: "3QFX",
|
},
|
||||||
icon: ListTodo,
|
],
|
||||||
path: "/page/strategy/task-management/plan-task-sentiment",
|
},
|
||||||
},
|
{
|
||||||
{
|
id: "ty-center-task",
|
||||||
id: "coh-task-fx",
|
label: "TY中任务",
|
||||||
label: "任务FX",
|
icon: Folder,
|
||||||
icon: ListTodo,
|
children: [
|
||||||
path: "/page/strategy/task-management/plan-task/plan-task-fx",
|
{
|
||||||
},
|
id: "ty-task-xdty",
|
||||||
{
|
label: "XDTY任务",
|
||||||
id: "coh-task-xdfx",
|
icon: ListTodo,
|
||||||
label: "XDFX",
|
path: "/page/strategy/task-management/mnty-task-mechanism",
|
||||||
icon: ListTodo,
|
},
|
||||||
path: "/page/strategy/task-management/plan-task/plan-task-action",
|
{
|
||||||
},
|
id: "ty-task-plan",
|
||||||
],
|
label: "方案TY任务",
|
||||||
},
|
icon: ListTodo,
|
||||||
{
|
path: "/page/strategy/task-management/mnty-task-plan",
|
||||||
id: "pg-center-task",
|
},
|
||||||
label: "PG中任务",
|
{
|
||||||
icon: Folder,
|
id: "ty-task-xxty",
|
||||||
children: [
|
label: "XXTY任务",
|
||||||
{
|
icon: ListTodo,
|
||||||
id: "pg-task-pg",
|
path: "/page/strategy/task-management/mnty-task-zsty",
|
||||||
label: "任务PG",
|
},
|
||||||
icon: ListTodo,
|
],
|
||||||
path: "/page/strategy/task-management/effect-task-pg",
|
},
|
||||||
},
|
],
|
||||||
{
|
},
|
||||||
id: "pg-task-xdpg",
|
{
|
||||||
label: "XDPG",
|
id: "light-app-center",
|
||||||
icon: ListTodo,
|
label: "应用中心",
|
||||||
path: "/page/strategy/task-management/effect-action-pg",
|
icon: Grid3X3,
|
||||||
},
|
children: [
|
||||||
{
|
{
|
||||||
id: "pg-task-info-pg",
|
id: "light-app-management",
|
||||||
label: "信息PG",
|
label: "应用管理",
|
||||||
icon: ListTodo,
|
icon: Layout,
|
||||||
path: "/page/strategy/task-management/effect-info-pg",
|
path: "/page/strategy/light-app/management",
|
||||||
},
|
adminOnly: true,
|
||||||
],
|
},
|
||||||
},
|
{
|
||||||
{
|
id: "light-app-apps",
|
||||||
id: "ty-center-task",
|
label: "应用列表",
|
||||||
label: "TY中任务",
|
icon: List,
|
||||||
icon: Folder,
|
path: "/page/strategy/light-app/apps",
|
||||||
children: [
|
},
|
||||||
{
|
],
|
||||||
id: "ty-task-xdty",
|
},
|
||||||
label: "XDTY任务",
|
{
|
||||||
icon: ListTodo,
|
id: "comprehensive-management",
|
||||||
path: "/page/strategy/task-management/mnty-task-mechanism",
|
label: "综合管理",
|
||||||
},
|
icon: Settings,
|
||||||
{
|
children: [
|
||||||
id: "ty-task-plan",
|
{ id: "mgmt-agents", label: "智能体管理", icon: Bot, path: "/page/strategy/agents" },
|
||||||
label: "方案TY任务",
|
{
|
||||||
icon: ListTodo,
|
id: "mgmt-business-chain-mapping",
|
||||||
path: "/page/strategy/task-management/mnty-task-plan",
|
label: "配置管理",
|
||||||
},
|
icon: Network,
|
||||||
{
|
path: "/page/strategy/business-chain-mapping",
|
||||||
id: "ty-task-xxty",
|
},
|
||||||
label: "XXTY任务",
|
{
|
||||||
icon: ListTodo,
|
id: "mgmt-business-chains",
|
||||||
path: "/page/strategy/task-management/mnty-task-zsty",
|
label: "业务链条配置",
|
||||||
},
|
icon: Layers,
|
||||||
],
|
path: "/page/strategy/business-chains",
|
||||||
},
|
},
|
||||||
],
|
{ id: "mgmt-skills", label: "技能管理", icon: Sparkles, path: "/page/strategy/skills" },
|
||||||
},
|
{ id: "mgmt-memory", label: "记忆管理", icon: Brain, path: "/page/strategy/memory" },
|
||||||
{
|
{
|
||||||
id: "comprehensive-management",
|
id: "mgmt-tasks",
|
||||||
label: "综合管理",
|
label: "定时任务",
|
||||||
icon: Settings,
|
icon: ListChecks,
|
||||||
children: [
|
path: "/page/strategy/scheduled/tasks",
|
||||||
{ id: "mgmt-agents", label: "智能体管理", icon: Bot, path: "/page/strategy/agents" },
|
},
|
||||||
{
|
{
|
||||||
id: "mgmt-business-chain-mapping",
|
id: "mgmt-llm-metrics",
|
||||||
label: "配置管理",
|
label: "大模型调用统计",
|
||||||
icon: Network,
|
icon: Gauge,
|
||||||
path: "/page/strategy/business-chain-mapping",
|
path: "/page/strategy/settings/llm-metrics",
|
||||||
},
|
adminOnly: true,
|
||||||
{
|
},
|
||||||
id: "mgmt-business-chains",
|
{
|
||||||
label: "业务链条配置",
|
id: "mgmt-users",
|
||||||
icon: Layers,
|
label: "用户管理",
|
||||||
path: "/page/strategy/business-chains",
|
icon: Users,
|
||||||
},
|
path: "/page/strategy/admin/users",
|
||||||
{ id: "mgmt-skills", label: "技能管理", icon: Sparkles, path: "/page/strategy/skills" },
|
adminOnly: true,
|
||||||
{ id: "mgmt-memory", label: "记忆管理", icon: Brain, path: "/page/strategy/memory" },
|
},
|
||||||
{
|
{
|
||||||
id: "mgmt-tasks",
|
id: "mgmt-user-leaderboard",
|
||||||
label: "定时任务",
|
label: "用户排行榜",
|
||||||
icon: ListChecks,
|
icon: Trophy,
|
||||||
path: "/page/strategy/scheduled/tasks",
|
path: "/page/strategy/admin/user-leaderboard",
|
||||||
},
|
adminOnly: true,
|
||||||
{
|
},
|
||||||
id: "mgmt-llm-metrics",
|
{
|
||||||
label: "大模型调用统计",
|
id: "mgmt-admin-scheduled-tasks",
|
||||||
icon: Gauge,
|
label: "定时任务管理",
|
||||||
path: "/page/strategy/settings/llm-metrics",
|
icon: CalendarClock,
|
||||||
adminOnly: true,
|
path: "/page/strategy/admin/scheduled-tasks",
|
||||||
},
|
adminOnly: true,
|
||||||
{
|
},
|
||||||
id: "mgmt-users",
|
{
|
||||||
label: "用户管理",
|
id: "mgmt-user-activity",
|
||||||
icon: Users,
|
label: "用户活动审计",
|
||||||
path: "/page/strategy/admin/users",
|
icon: History,
|
||||||
adminOnly: true,
|
path: "/page/strategy/admin/user-activity",
|
||||||
},
|
adminOnly: true,
|
||||||
{
|
},
|
||||||
id: "mgmt-user-leaderboard",
|
],
|
||||||
label: "用户排行榜",
|
},
|
||||||
icon: Trophy,
|
{
|
||||||
path: "/page/strategy/admin/user-leaderboard",
|
id: "resource-management",
|
||||||
adminOnly: true,
|
label: "资源管理",
|
||||||
},
|
icon: Database,
|
||||||
{
|
children: [
|
||||||
id: "mgmt-admin-scheduled-tasks",
|
{
|
||||||
label: "定时任务管理",
|
id: "resource-network-xwt",
|
||||||
icon: CalendarClock,
|
label: "网络xwt资源管理",
|
||||||
path: "/page/strategy/admin/scheduled-tasks",
|
icon: Network,
|
||||||
adminOnly: true,
|
path: "/page/strategy/resource-management/resource-network-actor",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "mgmt-user-activity",
|
id: "resource-knowledge-native",
|
||||||
label: "用户活动审计",
|
label: "问答梳理",
|
||||||
icon: History,
|
icon: BookOpen,
|
||||||
path: "/page/strategy/admin/user-activity",
|
path: "/page/workspace/knowledge",
|
||||||
adminOnly: true,
|
},
|
||||||
},
|
{
|
||||||
],
|
id: "resource-knowledge-base",
|
||||||
},
|
label: "知识库资源管理",
|
||||||
{
|
icon: Library,
|
||||||
id: "resource-management",
|
path: "/page/strategy/resource-management/resource-knowledge-base",
|
||||||
label: "资源管理",
|
},
|
||||||
icon: Database,
|
{
|
||||||
children: [
|
id: "resource-evaluation-index",
|
||||||
{
|
label: "作战资源管理",
|
||||||
id: "resource-network-xwt",
|
icon: FileBox,
|
||||||
label: "网络xwt资源管理",
|
path: "/page/strategy/resource-management/resource-evaluation-index",
|
||||||
icon: Network,
|
},
|
||||||
path: "/page/strategy/resource-management/resource-network-actor",
|
],
|
||||||
},
|
},
|
||||||
{
|
];
|
||||||
id: "resource-knowledge-native",
|
|
||||||
label: "问答梳理",
|
/** 默认展开的菜单 id 集合(浅色版可折叠交互的初始状态) */
|
||||||
icon: BookOpen,
|
export const defaultExpandedIds: ReadonlySet<string> = new Set([
|
||||||
path: "/page/workspace/knowledge",
|
"qa-center",
|
||||||
},
|
"light-app-center",
|
||||||
{
|
"light-app-note-management",
|
||||||
id: "resource-evaluation-index",
|
"task-management",
|
||||||
label: "作战资源管理",
|
"xk-center-task",
|
||||||
icon: FileBox,
|
"comprehensive-management",
|
||||||
path: "/page/strategy/resource-management/resource-evaluation-index",
|
]);
|
||||||
},
|
|
||||||
],
|
/** 按 admin 角色过滤菜单:非 admin 不展示 ``adminOnly: true`` 的项及其子项 */
|
||||||
},
|
export function filterMenuItemsByRole(items: MenuItem[], isAdmin: boolean): MenuItem[] {
|
||||||
];
|
return items
|
||||||
|
.filter((item) => !item.adminOnly || isAdmin)
|
||||||
/** 默认展开的菜单 id 集合。 */
|
.map((item) =>
|
||||||
export const defaultExpandedIds: ReadonlySet<string> = new Set([
|
item.children
|
||||||
"qa-center",
|
? { ...item, children: filterMenuItemsByRole(item.children, isAdmin) }
|
||||||
"light-app-center",
|
: item,
|
||||||
"light-app-note-management",
|
);
|
||||||
"task-management",
|
}
|
||||||
"xk-center-task",
|
|
||||||
"comprehensive-management",
|
|
||||||
]);
|
|
||||||
|
|
||||||
/** 按 admin 角色过滤菜单:非 admin 不展示 ``adminOnly: true`` 的项及其子项。 */
|
|
||||||
export function filterMenuItemsByRole(items: MenuItem[], isAdmin: boolean): MenuItem[] {
|
|
||||||
return items
|
|
||||||
.filter((item) => !item.adminOnly || isAdmin)
|
|
||||||
.map((item) =>
|
|
||||||
item.children
|
|
||||||
? { ...item, children: filterMenuItemsByRole(item.children, isAdmin) }
|
|
||||||
: item,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user