record.go 802 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package consume
  2. import (
  3. "time"
  4. "github.com/labring/aiproxy/core/model"
  5. "github.com/labring/aiproxy/core/relay/meta"
  6. )
  7. func recordConsume(
  8. now time.Time,
  9. meta *meta.Meta,
  10. code int,
  11. firstByteAt time.Time,
  12. usage model.Usage,
  13. modelPrice model.Price,
  14. content string,
  15. ip string,
  16. requestDetail *model.RequestDetail,
  17. amount float64,
  18. retryTimes int,
  19. downstreamResult bool,
  20. user string,
  21. metadata map[string]string,
  22. ) error {
  23. return model.BatchRecordLogs(
  24. now,
  25. meta.RequestID,
  26. meta.RequestAt,
  27. meta.RetryAt,
  28. firstByteAt,
  29. meta.Group.ID,
  30. code,
  31. meta.Channel.ID,
  32. meta.OriginModel,
  33. meta.Token.ID,
  34. meta.Token.Name,
  35. meta.Endpoint,
  36. content,
  37. int(meta.Mode),
  38. ip,
  39. retryTimes,
  40. requestDetail,
  41. downstreamResult,
  42. usage,
  43. modelPrice,
  44. amount,
  45. user,
  46. metadata,
  47. )
  48. }