diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 0d41c26..4118637 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -891,6 +891,10 @@ export const adminAPI = { getAgentToolPolicy: (id: string) => get(`/admin/agents/${id}/tool-policy`), setAgentToolPolicy: (id: string, toolPolicy: any) => put(`/admin/agents/${id}/tool-policy`, { tool_policy: toolPolicy }), + // Phase 3.3: 多 Agent 编排图 (orchestration) + getAgentOrchestration: (id: string) => get(`/admin/agents/${id}/orchestration`), + setAgentOrchestration: (id: string, orchestration: any) => put(`/admin/agents/${id}/orchestration`, { orchestration }), + getAdminAvailableSkills: (params?: any) => { const query = params ? '?' + Object.entries(params).filter(([_, v]) => v !== undefined && v !== '').map(([k, v]) => `${k}=${v}`).join('&') : ''; diff --git a/frontend/src/pages/admin/Agents.tsx b/frontend/src/pages/admin/Agents.tsx index cfd6f71..b99d1d0 100644 --- a/frontend/src/pages/admin/Agents.tsx +++ b/frontend/src/pages/admin/Agents.tsx @@ -109,6 +109,9 @@ const Agents: React.FC = () => { const [availableMcps, setAvailableMcps] = useState([]); // Tool policy (sandbox) — null means disabled / no policy const [toolPolicy, setToolPolicy] = useState(null); + // Phase 3.3: orchestration graph editor (JSON text + error) + const [orchestrationText, setOrchestrationText] = useState(''); + const [orchestrationError, setOrchestrationError] = useState(''); // Toast const [toast, setToast] = useState<{ msg: string; type: 'success' | 'error' } | null>(null); @@ -195,6 +198,8 @@ const Agents: React.FC = () => { reasoning_enabled: false, }); setToolPolicy(null); + setOrchestrationText(''); + setOrchestrationError(''); setShowModal(true); }; @@ -203,6 +208,7 @@ const Agents: React.FC = () => { setEditingAgent(agent); await loadAvailable(); await openEditLoadPolicy(agent.id); + await openEditLoadOrchestration(agent.id); const cfg = agent.config || {}; setForm({ @@ -231,6 +237,17 @@ const Agents: React.FC = () => { setToolPolicy(null); } }; + // Phase 3.3: 载入已有编排图 + const openEditLoadOrchestration = async (agentId: string) => { + try { + const oRes = await adminAPI.getAgentOrchestration(agentId) as any; + const og = oRes?.data?.orchestration; + setOrchestrationText(og ? JSON.stringify(og, null, 2) : ''); + setOrchestrationError(''); + } catch { + setOrchestrationText(''); + } + }; const openDetail = async (agent: Agent) => { setDetailAgent(agent); setShowDetail(true); @@ -716,6 +733,89 @@ const Agents: React.FC = () => { )} )} + {editingAgent && ( +
+
+
🕸️ 多 Agent 编排图 (orchestration)
+
+ 用有向图描述多个智能体的协作:节点类型 llm / local / external / reduce,边 from→to 表示数据流。留空表示不启用编排(走原对话逻辑)。 +
+