diff --git a/frontend/src/components/Agent/WorkerIndividualSettings.tsx b/frontend/src/components/Agent/WorkerIndividualSettings.tsx index 22bc619..c13c66c 100644 --- a/frontend/src/components/Agent/WorkerIndividualSettings.tsx +++ b/frontend/src/components/Agent/WorkerIndividualSettings.tsx @@ -14,12 +14,15 @@ interface WorkerIndividual { output_template?: string; // Change to string for the form state bound_skill?: string; // Change to string for the form state workspace?: string; // Change to string for the form state + tools?: string; // Form state for tools JSON array } export function WorkerIndividualSettings() { const [providers, setProviders] = useState([]); const [workers, setWorkers] = useState([]); const [systemNodes, setSystemNodes] = useState([]); + const [availableSkills, setAvailableSkills] = useState([]); + const [availableTools, setAvailableTools] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(''); @@ -32,14 +35,20 @@ export function WorkerIndividualSettings() { const fetchData = async () => { setLoading(true); try { - const [provRes, workRes, sysRes] = await Promise.all([ + const [provRes, workRes, sysRes, toolsRes, skillsRes] = await Promise.all([ apiClient.get('/api/v1/provider/list'), apiClient.get('/api/v1/agent/worker'), - apiClient.get('/api/v1/agent') + apiClient.get('/api/v1/agent'), + apiClient.get('/api/v1/resource/tool'), + apiClient.get('/api/v1/resource/skill') ]); setProviders(Object.values(provRes.data.provider_list || {})); setWorkers(workRes.data.workers || []); + const allTools = toolsRes.data.tools ? Object.values(toolsRes.data.tools).flatMap(tGroup => Object.keys(tGroup as any)) : []; + setAvailableTools(allTools); + setAvailableSkills(Object.keys(skillsRes.data.skills || {})); + const sysNodesData = sysRes.data.system_nodes || []; const defaultSysNodes = ['supervisory_node', 'consciousness_node', 'control_node']; @@ -54,6 +63,7 @@ export function WorkerIndividualSettings() { agent_type: 'System Node', provider_title: found && found.provider_title ? found.provider_title : defaultProvider, model_id: found && found.model_id ? found.model_id : '', + tools: found && found.tools ? JSON.stringify(found.tools) : '[]', is_system: true }; }); @@ -75,7 +85,8 @@ export function WorkerIndividualSettings() { ...worker, output_template: typeof worker.output_template === 'string' ? worker.output_template : JSON.stringify(worker.output_template || {}), bound_skill: typeof worker.bound_skill === 'string' ? worker.bound_skill : JSON.stringify(worker.bound_skill || {}), - workspace: typeof worker.workspace === 'string' ? worker.workspace : JSON.stringify(worker.workspace || []) + workspace: typeof worker.workspace === 'string' ? worker.workspace : JSON.stringify(worker.workspace || []), + tools: typeof worker.tools === 'string' ? worker.tools : JSON.stringify(worker.tools || []) }); setIsNew(false); setIsEditing(true); @@ -92,7 +103,8 @@ export function WorkerIndividualSettings() { system_prompt: '', output_template: '{}', bound_skill: '{}', - workspace: '[]' + workspace: '[]', + tools: '[]' }); setIsNew(true); setIsEditing(true); @@ -118,7 +130,8 @@ export function WorkerIndividualSettings() { const payload = { individual_name: editData.agent_name, provider_title: editData.provider_title, - model_id: editData.model_id + model_id: editData.model_id, + tools: JSON.parse(editData.tools || '[]') }; await apiClient.post('/api/v1/agent', payload); } else { @@ -126,7 +139,8 @@ export function WorkerIndividualSettings() { ...editData, output_template: JSON.parse(editData.output_template || '{}'), bound_skill: JSON.parse(editData.bound_skill || '{}'), - workspace: JSON.parse(editData.workspace || '[]') + workspace: JSON.parse(editData.workspace || '[]'), + tools: JSON.parse(editData.tools || '[]') }; if (isNew) { @@ -332,13 +346,27 @@ export function WorkerIndividualSettings() { />
- -