后端没修完版

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
@@ -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,