Skip to content

Commit 1a9b916

Browse files
committed
fix bug: fail to get ai logs
1 parent 5f40d50 commit 1a9b916

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

mcp-server/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ func SetServerByOpenapi(sid, name, version, content string) error {
156156
toolOptions = append(toolOptions, mcp.WithDescription(a.Description))
157157
params := make(map[string]*Param)
158158
for _, v := range a.Params {
159+
if v.In == "header" && v.Name == "Authorization" {
160+
continue
161+
}
159162
params[v.Name] = NewParam(Position(v.In), v.Required, v.Description)
160163
options := make([]mcp.PropertyOption, 0, 2)
161164
if v.Required {

module/service/iml.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,18 @@ func (i *imlServiceModule) AILogs(ctx context.Context, serviceId string, start i
236236
return nil, 0, err
237237
}
238238
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+
}
239243
item := &service_dto.AILogItem{
240244
Id: s.ID,
241245
API: auto.UUID(s.API),
242246
Status: s.StatusCode,
243247
LogTime: auto.TimeLabel(s.RecordTime),
244248
Ip: s.RemoteIP,
245249
Token: s.TotalToken,
246-
TokenPerSecond: s.TotalToken * 1000 / s.ResponseTime,
250+
TokenPerSecond: tokenPerSecond,
247251
Consumer: auto.UUID(s.Consumer),
248252
Provider: auto.UUID(s.AIProvider),
249253
Model: s.AIModel,

0 commit comments

Comments
 (0)