2026-03-21 10:13:35 +08:00
|
|
|
import api from './index'
|
|
|
|
|
|
|
|
|
|
export interface AgentStats {
|
|
|
|
|
agent_id: string
|
|
|
|
|
call_count: number
|
|
|
|
|
current_task: string | null
|
|
|
|
|
status: 'active' | 'idle' | 'disabled'
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-24 21:44:04 +08:00
|
|
|
export interface AgentHierarchyStatsNode extends AgentStats {
|
|
|
|
|
sub_commanders: AgentStats[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface AgentHierarchyStats {
|
|
|
|
|
main_agents: AgentHierarchyStatsNode[]
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-21 10:13:35 +08:00
|
|
|
export interface AgentConfig {
|
|
|
|
|
id: string
|
|
|
|
|
name: string
|
|
|
|
|
role: string
|
|
|
|
|
description: string
|
|
|
|
|
system_prompt: string
|
|
|
|
|
enabled: boolean
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const agentApi = {
|
|
|
|
|
async getStats(): Promise<AgentStats[]> {
|
|
|
|
|
const res = await api.get('/api/agents/stats')
|
|
|
|
|
return res.data
|
|
|
|
|
},
|
|
|
|
|
|
2026-03-24 21:44:04 +08:00
|
|
|
async getHierarchyStats(): Promise<AgentHierarchyStats> {
|
|
|
|
|
const res = await api.get('/api/agents/stats/hierarchy')
|
|
|
|
|
return res.data
|
|
|
|
|
},
|
|
|
|
|
|
2026-03-21 10:13:35 +08:00
|
|
|
async getConfig(id: string): Promise<AgentConfig> {
|
|
|
|
|
const res = await api.get(`/api/agents/config/${id}`)
|
|
|
|
|
return res.data
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async updateConfig(id: string, data: Partial<AgentConfig>): Promise<AgentConfig> {
|
|
|
|
|
const res = await api.put(`/api/agents/config/${id}`, data)
|
|
|
|
|
return res.data
|
|
|
|
|
},
|
|
|
|
|
}
|