log.go 700 B

12345678910111213141516171819
  1. package service
  2. import (
  3. "github.com/gin-gonic/gin"
  4. relaycommon "one-api/relay/common"
  5. )
  6. func GenerateTextOtherInfo(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, modelRatio, groupRatio, completionRatio, modelPrice float64) map[string]interface{} {
  7. other := make(map[string]interface{})
  8. other["model_ratio"] = modelRatio
  9. other["group_ratio"] = groupRatio
  10. other["completion_ratio"] = completionRatio
  11. other["model_price"] = modelPrice
  12. other["frt"] = float64(relayInfo.FirstResponseTime.UnixMilli() - relayInfo.StartTime.UnixMilli())
  13. adminInfo := make(map[string]interface{})
  14. adminInfo["use_channel"] = ctx.GetStringSlice("use_channel")
  15. other["admin_info"] = adminInfo
  16. return other
  17. }