From fb8aac650f8eafb9d1325102d4e5925c9b667e21 Mon Sep 17 00:00:00 2001 From: skynono Date: Wed, 18 Jun 2025 10:56:33 +0800 Subject: [PATCH] fix: playground write user context to check acceptUnsetRatio --- controller/playground.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/controller/playground.go b/controller/playground.go index 37a5c7b0..10393250 100644 --- a/controller/playground.go +++ b/controller/playground.go @@ -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) }