(ctx context.Context, serviceId string, start int64, end int64, page int, size int)
| 231 | } |
| 232 | |
| 233 | func (i *imlServiceModule) AILogs(ctx context.Context, serviceId string, start int64, end int64, page int, size int) ([]*service_dto.AILogItem, int64, error) { |
| 234 | list, total, err := i.logService.LogRecordsByService(ctx, serviceId, time.Unix(start, 0), time.Unix(end, 0), page, size) |
| 235 | if err != nil { |
| 236 | return nil, 0, err |
| 237 | } |
| 238 | return utils.SliceToSlice(list, func(s *log_service.Item) *service_dto.AILogItem { |
| 239 | var tokenPerSecond int64 = 0 |
| 240 | if s.ResponseTime > 0 { |
| 241 | tokenPerSecond = s.TotalToken * 1000 / s.ResponseTime |
| 242 | } |
| 243 | item := &service_dto.AILogItem{ |
| 244 | Id: s.ID, |
| 245 | API: auto.UUID(s.API), |
| 246 | Status: s.StatusCode, |
| 247 | LogTime: auto.TimeLabel(s.RecordTime), |
| 248 | Ip: s.RemoteIP, |
| 249 | Token: s.TotalToken, |
| 250 | TokenPerSecond: tokenPerSecond, |
| 251 | Consumer: auto.UUID(s.Consumer), |
| 252 | Provider: auto.UUID(s.AIProvider), |
| 253 | Model: s.AIModel, |
| 254 | } |
| 255 | if s.Consumer == "apipark-global" { |
| 256 | item.Consumer = auto.Label{ |
| 257 | Id: s.Consumer, |
| 258 | Name: "System Consumer", |
| 259 | } |
| 260 | } |
| 261 | return item |
| 262 | }), total, nil |
| 263 | } |
| 264 | |
| 265 | func (i *imlServiceModule) ServiceOverview(ctx context.Context, id string) (*service_dto.Overview, error) { |
| 266 | info, err := i.serviceService.Get(ctx, id) |
nothing calls this directly
no test coverage detected