修改stat接口返回值

This commit is contained in:
CaIon
2023-08-25 00:40:11 +08:00
parent 8f2119e410
commit 3b0f1ae978
5 changed files with 54 additions and 25 deletions

View File

@@ -118,14 +118,15 @@ func GetLogsStat(c *gin.Context) {
tokenName := c.Query("token_name")
username := c.Query("username")
modelName := c.Query("model_name")
quotaNum := model.SumUsedQuota(logType, startTimestamp, endTimestamp, modelName, username, tokenName)
stat := model.SumUsedQuota(logType, startTimestamp, endTimestamp, modelName, username, tokenName)
//tokenNum := model.SumUsedToken(logType, startTimestamp, endTimestamp, modelName, username, "")
c.JSON(200, gin.H{
"success": true,
"message": "",
"data": gin.H{
"quota": quotaNum,
//"token": tokenNum,
"quota": stat.Quota,
"rpm": stat.Rpm,
"tpm": stat.Tpm,
},
})
}
@@ -143,7 +144,9 @@ func GetLogsSelfStat(c *gin.Context) {
"success": true,
"message": "",
"data": gin.H{
"quota": quotaNum,
"quota": quotaNum.Quota,
"rpm": quotaNum.Rpm,
"tpm": quotaNum.Tpm,
//"token": tokenNum,
},
})