(req dto.AgentOverviewReq)
| 20 | ) |
| 21 | |
| 22 | func (a AgentService) GetOverview(req dto.AgentOverviewReq) (*dto.AgentOverview, error) { |
| 23 | agent, install, conf, err := a.loadOpenclawAgentConfig(req.AgentID) |
| 24 | if err != nil { |
| 25 | return nil, err |
| 26 | } |
| 27 | |
| 28 | overview := &dto.AgentOverview{ |
| 29 | Snapshot: dto.AgentOverviewSnapshot{ |
| 30 | ContainerStatus: install.Status, |
| 31 | AppVersion: install.Version, |
| 32 | DefaultModel: extractOpenclawDefaultModel(conf), |
| 33 | ChannelCount: countOpenclawConfiguredChannels(conf), |
| 34 | }, |
| 35 | } |
| 36 | if overview.Snapshot.DefaultModel == "" { |
| 37 | overview.Snapshot.DefaultModel = agent.Model |
| 38 | } |
| 39 | if install.Status != constant.StatusRunning { |
| 40 | return overview, nil |
| 41 | } |
| 42 | |
| 43 | var wg sync.WaitGroup |
| 44 | wg.Add(3) |
| 45 | go func() { |
| 46 | defer wg.Done() |
| 47 | skillCount, err := loadOpenclawOverviewSkillStats(install.ContainerName) |
| 48 | if err == nil { |
| 49 | overview.Snapshot.SkillCount = skillCount |
| 50 | } |
| 51 | }() |
| 52 | go func() { |
| 53 | defer wg.Done() |
| 54 | sessionCount, err := loadOpenclawOverviewSessionCount(install.GetPath()) |
| 55 | if err == nil { |
| 56 | overview.Snapshot.SessionCount = sessionCount |
| 57 | } |
| 58 | }() |
| 59 | go func() { |
| 60 | defer wg.Done() |
| 61 | jobCount, err := loadOpenclawOverviewJobCount(install.GetPath()) |
| 62 | if err == nil { |
| 63 | overview.Snapshot.JobCount = jobCount |
| 64 | } |
| 65 | }() |
| 66 | wg.Wait() |
| 67 | |
| 68 | return overview, nil |
| 69 | } |
| 70 | |
| 71 | func extractOpenclawDefaultModel(conf map[string]interface{}) string { |
| 72 | agents, ok := conf["agents"].(map[string]interface{}) |
nothing calls this directly
no test coverage detected