Repository navigation
Conversation
…d injection Playground has the same hardcoded-'auto'-group pattern that PR QuantumNous#4796 fixed in the API key form, but in two places: 1. `constants.ts:DEFAULT_GROUP = 'auto'` — initial config value for new visitors 2. `index.tsx:useEffect` — unconditionally injects an 'auto' option into the groups list returned by GET /api/user/self/groups when 'auto' isn't there Effect: every install showed 'auto' as the default selected group in the Playground. For operators who haven't configured AutoGroups in system options, selecting 'auto' silently fails to route any request — clicking Send produces no response, breaking the chat experience entirely. The user perceives the Playground as broken. Fix: - Change `DEFAULT_GROUP` to `'default'` (the standard built-in user group) - Remove the unconditional auto-injection - Add a migration fallback: if the persisted config.group isn't in the groups returned by the backend (e.g. a returning user whose localStorage retained 'auto' from a previous version), switch to DEFAULT_GROUP or the first available group. Mirrors the existing pattern for `config.model` validation in the same useEffect block. Verified locally: existing localStorage value of 'auto' migrates cleanly to the user's actual default group on next visit. New visitors land on the backend-supplied default group and can chat immediately.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe playground's group selection logic is refactored to use ChangesPlayground group selection refactoring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
* fix: theme-aware payment paths, auto-group validation, route guards, perf group filtering - Add common.ThemeAwarePath to generate correct redirect URLs based on active theme (default vs classic), replacing hardcoded /console/* paths in 7 controllers and service/quota.go (#4765) - Validate auto-group availability against getUserGroups before defaulting form values; playground falls back to 'default' group when 'auto' is unavailable (#4796, #4799) - Enforce HeaderNavModules settings in rankings route (frontend + backend API) and SidebarModulesAdmin in playground route to block direct URL access when features are disabled (#4704, #4512) - Filter perf_metrics API response to only include currently configured groups, hiding stale data from deleted groups (#4790) - Preserve query params (pay=success/fail) in /console/topup → /wallet frontend redirect * fix: update hero section text and localization strings for clarity
|
Closing — the bug has been addressed by #4802 ("fix: defaut ui triage") which not only removes the unconditional 'auto' injection but also adds a graceful fallback when the persisted group value isn't in the available groups returned by the backend. Cleaner solution than mine. Thanks! |
* fix: theme-aware payment paths, auto-group validation, route guards, perf group filtering - Add common.ThemeAwarePath to generate correct redirect URLs based on active theme (default vs classic), replacing hardcoded /console/* paths in 7 controllers and service/quota.go (QuantumNous#4765) - Validate auto-group availability against getUserGroups before defaulting form values; playground falls back to 'default' group when 'auto' is unavailable (QuantumNous#4796, QuantumNous#4799) - Enforce HeaderNavModules settings in rankings route (frontend + backend API) and SidebarModulesAdmin in playground route to block direct URL access when features are disabled (QuantumNous#4704, QuantumNous#4512) - Filter perf_metrics API response to only include currently configured groups, hiding stale data from deleted groups (QuantumNous#4790) - Preserve query params (pay=success/fail) in /console/topup → /wallet frontend redirect * fix: update hero section text and localization strings for clarity
* fix: theme-aware payment paths, auto-group validation, route guards, perf group filtering - Add common.ThemeAwarePath to generate correct redirect URLs based on active theme (default vs classic), replacing hardcoded /console/* paths in 7 controllers and service/quota.go (QuantumNous#4765) - Validate auto-group availability against getUserGroups before defaulting form values; playground falls back to 'default' group when 'auto' is unavailable (QuantumNous#4796, QuantumNous#4799) - Enforce HeaderNavModules settings in rankings route (frontend + backend API) and SidebarModulesAdmin in playground route to block direct URL access when features are disabled (QuantumNous#4704, QuantumNous#4512) - Filter perf_metrics API response to only include currently configured groups, hiding stale data from deleted groups (QuantumNous#4790) - Preserve query params (pay=success/fail) in /console/topup → /wallet frontend redirect * fix: update hero section text and localization strings for clarity
* fix: theme-aware payment paths, auto-group validation, route guards, perf group filtering - Add common.ThemeAwarePath to generate correct redirect URLs based on active theme (default vs classic), replacing hardcoded /console/* paths in 7 controllers and service/quota.go (QuantumNous#4765) - Validate auto-group availability against getUserGroups before defaulting form values; playground falls back to 'default' group when 'auto' is unavailable (QuantumNous#4796, QuantumNous#4799) - Enforce HeaderNavModules settings in rankings route (frontend + backend API) and SidebarModulesAdmin in playground route to block direct URL access when features are disabled (QuantumNous#4704, QuantumNous#4512) - Filter perf_metrics API response to only include currently configured groups, hiding stale data from deleted groups (QuantumNous#4790) - Preserve query params (pay=success/fail) in /console/topup → /wallet frontend redirect * fix: update hero section text and localization strings for clarity
* fix: theme-aware payment paths, auto-group validation, route guards, perf group filtering - Add common.ThemeAwarePath to generate correct redirect URLs based on active theme (default vs classic), replacing hardcoded /console/* paths in 7 controllers and service/quota.go (QuantumNous#4765) - Validate auto-group availability against getUserGroups before defaulting form values; playground falls back to 'default' group when 'auto' is unavailable (QuantumNous#4796, QuantumNous#4799) - Enforce HeaderNavModules settings in rankings route (frontend + backend API) and SidebarModulesAdmin in playground route to block direct URL access when features are disabled (QuantumNous#4704, QuantumNous#4512) - Filter perf_metrics API response to only include currently configured groups, hiding stale data from deleted groups (QuantumNous#4790) - Preserve query params (pay=success/fail) in /console/topup → /wallet frontend redirect * fix: update hero section text and localization strings for clarity
* fix: theme-aware payment paths, auto-group validation, route guards, perf group filtering - Add common.ThemeAwarePath to generate correct redirect URLs based on active theme (default vs classic), replacing hardcoded /console/* paths in 7 controllers and service/quota.go (QuantumNous#4765) - Validate auto-group availability against getUserGroups before defaulting form values; playground falls back to 'default' group when 'auto' is unavailable (QuantumNous#4796, QuantumNous#4799) - Enforce HeaderNavModules settings in rankings route (frontend + backend API) and SidebarModulesAdmin in playground route to block direct URL access when features are disabled (QuantumNous#4704, QuantumNous#4512) - Filter perf_metrics API response to only include currently configured groups, hiding stale data from deleted groups (QuantumNous#4790) - Preserve query params (pay=success/fail) in /console/topup → /wallet frontend redirect * fix: update hero section text and localization strings for clarity
Context
This is the same class of bug as #4796 (auto group injection in API key form), but in the Playground feature. Found while testing #4796 — the API key dropdown was fixed but the Playground still showed 'auto' as the default selected group and users couldn't chat.
Problem
The Playground hardcodes 'auto' as the group at two layers:
1.
constants.ts— initial configEvery new visitor opens the Playground with
config.group = 'auto'selected.2.
index.tsx— group dropdown populationIf the backend doesn't return 'auto' (because the operator didn't configure
AutoGroupsin system options —setting/auto_group.go), the frontend forcibly injects it.Effect
For operators who never configured AutoGroups (the default state), users see 'auto' as the default selected option in the Playground group dropdown. Clicking Send routes to the 'auto' group, which has no upstream channels mapped, so the request silently fails to route. From the user's perspective the Playground is broken — typing a message and hitting send does nothing.
Fix
DEFAULT_GROUPfrom'auto'to'default'— the standard user group that every install ships with viasetting/user_usable_group.go's defaults.GET /api/user/self/groupsreturns, no more.config.group(loaded from localStorage) isn't in the backend-returned groups, switch toDEFAULT_GROUPor the first available group. Mirrors the existing pattern in the sameuseEffectblock forconfig.modelvalidation. This handles returning users whose localStorage retained 'auto' from before this fix.Verification
config.group = 'auto'in localStorage: on next visit, fallback kicks in, group migrates to 'default' (or whatever the user's actual default is), chat worksconfig.group = 'somegroup'that's still configured: no change, keeps using that groupNo backend changes required. Pure frontend bugfix.
Summary by CodeRabbit
Bug Fixes