fix bug: fail to get ai logs

This commit is contained in:
Liujian
2025-08-15 16:25:49 +08:00
parent 5f40d5092c
commit 1a9b916bab
2 changed files with 8 additions and 1 deletions
+3
View File
@@ -156,6 +156,9 @@ func SetServerByOpenapi(sid, name, version, content string) error {
toolOptions = append(toolOptions, mcp.WithDescription(a.Description))
params := make(map[string]*Param)
for _, v := range a.Params {
if v.In == "header" && v.Name == "Authorization" {
continue
}
params[v.Name] = NewParam(Position(v.In), v.Required, v.Description)
options := make([]mcp.PropertyOption, 0, 2)
if v.Required {
+5 -1
View File
@@ -236,6 +236,10 @@ func (i *imlServiceModule) AILogs(ctx context.Context, serviceId string, start i
return nil, 0, err
}
return utils.SliceToSlice(list, func(s *log_service.Item) *service_dto.AILogItem {
var tokenPerSecond int64 = 0
if s.ResponseTime > 0 {
tokenPerSecond = s.TotalToken * 1000 / s.ResponseTime
}
item := &service_dto.AILogItem{
Id: s.ID,
API: auto.UUID(s.API),
@@ -243,7 +247,7 @@ func (i *imlServiceModule) AILogs(ctx context.Context, serviceId string, start i
LogTime: auto.TimeLabel(s.RecordTime),
Ip: s.RemoteIP,
Token: s.TotalToken,
TokenPerSecond: s.TotalToken * 1000 / s.ResponseTime,
TokenPerSecond: tokenPerSecond,
Consumer: auto.UUID(s.Consumer),
Provider: auto.UUID(s.AIProvider),
Model: s.AIModel,