Merge remote-tracking branch 'origin/main' into alpha

This commit is contained in:
t0ng7u
2025-06-21 20:25:35 +08:00
5 changed files with 170 additions and 5 deletions

View File

@@ -66,5 +66,14 @@ func Playground(c *gin.Context) {
}
middleware.SetupContextForSelectedChannel(c, channel, playgroundRequest.Model)
c.Set(constant.ContextKeyRequestStartTime, time.Now())
// Write user context to ensure acceptUnsetRatio is available
userId := c.GetInt("id")
userCache, err := model.GetUserCache(userId)
if err != nil {
openaiErr = service.OpenAIErrorWrapperLocal(err, "get_user_cache_failed", http.StatusInternalServerError)
return
}
userCache.WriteContext(c)
Relay(c)
}