mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-25 22:06:06 +00:00
后端没修完版
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user