后端没修完版

This commit is contained in:
Typer_Body
2026-05-05 15:08:04 +08:00
parent a8fba46040
commit e7c9bc69d3
156 changed files with 34633 additions and 2149 deletions
@@ -116,6 +116,7 @@ function compareVersions(v1: string, v2: string): boolean {
const ENTITY_CATEGORY_IDS = [
'bots',
'pipelines',
'workflows',
'knowledge',
'plugins',
'mcp',
@@ -126,6 +127,7 @@ type EntityCategoryId = (typeof ENTITY_CATEGORY_IDS)[number];
const DETAIL_PAGE_CATEGORIES: EntityCategoryId[] = [
'bots',
'pipelines',
'workflows',
'knowledge',
'plugins',
'mcp',
@@ -135,6 +137,7 @@ const DETAIL_PAGE_CATEGORIES: EntityCategoryId[] = [
const CREATABLE_CATEGORIES: EntityCategoryId[] = [
'bots',
'pipelines',
'workflows',
'knowledge',
'mcp',
'plugins',
@@ -144,6 +147,7 @@ const CREATABLE_CATEGORIES: EntityCategoryId[] = [
const COLLAPSIBLE_ONLY_CATEGORIES: EntityCategoryId[] = [
'bots',
'pipelines',
'workflows',
'knowledge',
'mcp',
];
@@ -155,10 +159,11 @@ function isEntityCategory(id: string): id is EntityCategoryId {
// Map sidebar config IDs to SidebarDataContext keys
const ENTITY_KEY_MAP: Record<
EntityCategoryId,
'bots' | 'pipelines' | 'knowledgeBases' | 'plugins' | 'mcpServers'
'bots' | 'pipelines' | 'workflows' | 'knowledgeBases' | 'plugins' | 'mcpServers'
> = {
bots: 'bots',
pipelines: 'pipelines',
workflows: 'workflows',
knowledge: 'knowledgeBases',
plugins: 'plugins',
mcp: 'mcpServers',
@@ -168,6 +173,7 @@ const ENTITY_KEY_MAP: Record<
const ENTITY_ROUTE_MAP: Record<EntityCategoryId, string> = {
bots: '/home/bots',
pipelines: '/home/pipelines',
workflows: '/home/workflows',
knowledge: '/home/knowledge',
plugins: '/home/plugins',
mcp: '/home/mcp',
@@ -717,13 +723,13 @@ function NavItems({
(isPlugin ? (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button
type="button"
className="p-1 rounded-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [@media(hover:hover)]:opacity-0 group-hover/category-header:opacity-100 transition-all"
<div
role="button"
className="p-1 rounded-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [@media(hover:hover)]:opacity-0 group-hover/category-header:opacity-100 transition-all cursor-pointer"
onClick={(e) => e.stopPropagation()}
>
<Plus className="size-3.5" />
</button>
</div>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
{systemInfo.enable_marketplace && (
@@ -760,25 +766,25 @@ function NavItems({
</DropdownMenuContent>
</DropdownMenu>
) : (
<button
type="button"
className="p-1 rounded-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [@media(hover:hover)]:opacity-0 group-hover/category-header:opacity-100 transition-all"
<div
role="button"
className="p-1 rounded-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [@media(hover:hover)]:opacity-0 group-hover/category-header:opacity-100 transition-all cursor-pointer"
onClick={(e) => {
e.stopPropagation();
navigate(`${routePrefix}?id=new`);
}}
>
<Plus className="size-3.5" />
</button>
</div>
))}
<CollapsibleTrigger asChild>
<button
type="button"
className="p-1 rounded-sm hover:bg-sidebar-accent"
<div
role="button"
className="p-1 rounded-sm hover:bg-sidebar-accent cursor-pointer"
onClick={(e) => e.stopPropagation()}
>
<ChevronRight className="size-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" />
</button>
</div>
</CollapsibleTrigger>
</div>
</SidebarMenuButton>
@@ -35,11 +35,13 @@ export type PluginInstallAction = 'local' | 'github' | null;
export interface SidebarDataContextValue {
bots: SidebarEntityItem[];
pipelines: SidebarEntityItem[];
workflows: SidebarEntityItem[];
knowledgeBases: SidebarEntityItem[];
plugins: SidebarEntityItem[];
mcpServers: SidebarEntityItem[];
refreshBots: () => Promise<void>;
refreshPipelines: () => Promise<void>;
refreshWorkflows: () => Promise<void>;
refreshKnowledgeBases: () => Promise<void>;
refreshPlugins: () => Promise<void>;
refreshMCPServers: () => Promise<void>;
@@ -61,6 +63,7 @@ export function SidebarDataProvider({
}) {
const [bots, setBots] = useState<SidebarEntityItem[]>([]);
const [pipelines, setPipelines] = useState<SidebarEntityItem[]>([]);
const [workflows, setWorkflows] = useState<SidebarEntityItem[]>([]);
const [knowledgeBases, setKnowledgeBases] = useState<SidebarEntityItem[]>([]);
const [plugins, setPlugins] = useState<SidebarEntityItem[]>([]);
const [mcpServers, setMCPServers] = useState<SidebarEntityItem[]>([]);
@@ -103,6 +106,24 @@ export function SidebarDataProvider({
}
}, []);
const refreshWorkflows = useCallback(async () => {
try {
const resp = await httpClient.getWorkflows();
setWorkflows(
resp.workflows.map((w) => ({
id: w.uuid || '',
name: w.name,
description: w.description,
emoji: w.emoji,
updatedAt: w.updated_at,
enabled: w.is_enabled ?? true,
})),
);
} catch (error) {
console.error('Failed to fetch workflows for sidebar:', error);
}
}, []);
const refreshKnowledgeBases = useCallback(async () => {
try {
const resp = await httpClient.getKnowledgeBases();
@@ -189,6 +210,7 @@ export function SidebarDataProvider({
await Promise.all([
refreshBots(),
refreshPipelines(),
refreshWorkflows(),
refreshKnowledgeBases(),
refreshPlugins(),
refreshMCPServers(),
@@ -196,6 +218,7 @@ export function SidebarDataProvider({
}, [
refreshBots,
refreshPipelines,
refreshWorkflows,
refreshKnowledgeBases,
refreshPlugins,
refreshMCPServers,
@@ -211,11 +234,13 @@ export function SidebarDataProvider({
value={{
bots,
pipelines,
workflows,
knowledgeBases,
plugins,
mcpServers,
refreshBots,
refreshPipelines,
refreshWorkflows,
refreshKnowledgeBases,
refreshPlugins,
refreshMCPServers,
@@ -95,6 +95,27 @@ export const sidebarConfigList = [
},
section: 'home',
}),
new SidebarChildVO({
id: 'workflows',
name: t('workflows.title'),
icon: (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
className="text-blue-500"
>
<path d="M2 3C2 2.44772 2.44772 2 3 2H7C7.55228 2 8 2.44772 8 3V7C8 7.55228 7.55228 8 7 8H5V11H11V9C11 8.44772 11.4477 8 12 8H21C21.5523 8 22 8.44772 22 9V13C22 13.5523 21.5523 14 21 14H12C11.4477 14 11 13.5523 11 13V12H5V17H11V15C11 14.4477 11.4477 14 12 14H21C21.5523 14 22 14.4477 22 15V19C22 19.5523 21.5523 20 21 20H12C11.4477 20 11 19.5523 11 19V18H4C3.44772 18 3 17.5523 3 17V8H3C2.44772 8 2 7.55228 2 7V3ZM4 4V6H6V4H4ZM13 10V12H20V10H13ZM13 16V18H20V16H13Z"></path>
</svg>
),
route: '/home/workflows',
description: t('workflows.description'),
helpLink: {
en_US: '',
zh_Hans: '',
},
section: 'home',
}),
new SidebarChildVO({
id: 'knowledge',
name: t('knowledge.title'),