mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 05:41:37 +00:00
fix: channel affinity (#2799)
* fix: channel affinity log styles * fix: Issue with incorrect data storage when switching key sources * feat: support not retrying after a single rule configuration fails * fix: render channel affinity tooltip as multiline content * feat: channel affinity cache hit * fix: prevent ChannelAffinityUsageCacheModal infinite loading and hide data before fetch * chore: format backend with gofmt and frontend with prettier/eslint autofix
This commit is contained in:
@@ -58,3 +58,31 @@ func ClearChannelAffinityCache(c *gin.Context) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func GetChannelAffinityUsageCacheStats(c *gin.Context) {
|
||||
ruleName := strings.TrimSpace(c.Query("rule_name"))
|
||||
usingGroup := strings.TrimSpace(c.Query("using_group"))
|
||||
keyFp := strings.TrimSpace(c.Query("key_fp"))
|
||||
|
||||
if ruleName == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"success": false,
|
||||
"message": "missing param: rule_name",
|
||||
})
|
||||
return
|
||||
}
|
||||
if keyFp == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{
|
||||
"success": false,
|
||||
"message": "missing param: key_fp",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
stats := service.GetChannelAffinityUsageCacheStats(ruleName, usingGroup, keyFp)
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"message": "",
|
||||
"data": stats,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user