Changeset 0.22.7 (#149)
This commit is contained in:
@@ -112,6 +112,11 @@ type NotesPageData struct {
|
||||
// SettingsPageData is what the settings surface templates receive.
|
||||
type SettingsPageData struct {
|
||||
Section string `json:"section"`
|
||||
|
||||
// v0.22.7: Feature gates from admin config.
|
||||
// These control which nav links/tabs are visible in the settings surface.
|
||||
BYOKEnabled bool `json:"BYOKEnabled"`
|
||||
UserPersonasEnabled bool `json:"UserPersonasEnabled"`
|
||||
}
|
||||
|
||||
// ── Loader registration ──────────────────────
|
||||
@@ -290,7 +295,7 @@ func sectionCategory(section string) string {
|
||||
switch section {
|
||||
case "users", "teams", "groups":
|
||||
return "people"
|
||||
case "providers", "models", "presets", "roles", "knowledgeBases", "memory":
|
||||
case "providers", "models", "personas", "roles", "knowledgeBases", "memory":
|
||||
return "ai"
|
||||
case "health", "routing", "capabilities":
|
||||
return "routing"
|
||||
@@ -373,7 +378,6 @@ func (e *Engine) loadUsers(ctx context.Context, s store.Stores) []UserRow {
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
// ── Editor loader ────────────────────────────
|
||||
// Resolves workspace from URL param. The heavy lifting (file tree, CodeMirror)
|
||||
// is done client-side by editor-mode.js.
|
||||
@@ -400,13 +404,35 @@ func (e *Engine) notesLoader(c *gin.Context, s store.Stores) (any, error) {
|
||||
}
|
||||
|
||||
// ── Settings loader ──────────────────────────
|
||||
// Most settings sections are populated client-side by existing JS.
|
||||
// Server just passes the section name for navigation highlighting.
|
||||
// v0.22.7: Reads feature gates from GlobalConfig to control
|
||||
// which nav links/tabs are visible (BYOK, User Personas).
|
||||
|
||||
func (e *Engine) settingsLoader(c *gin.Context, s store.Stores) (any, error) {
|
||||
section := c.Param("section")
|
||||
if section == "" {
|
||||
section = "general"
|
||||
}
|
||||
return &SettingsPageData{Section: section}, nil
|
||||
|
||||
data := &SettingsPageData{Section: section}
|
||||
|
||||
// Read feature gates from admin config
|
||||
if s.GlobalConfig != nil {
|
||||
ctx := context.Background()
|
||||
|
||||
// BYOK: check if user providers are enabled
|
||||
if raw, err := s.GlobalConfig.Get(ctx, "user_providers"); err == nil && raw != nil {
|
||||
if v, ok := raw["enabled"].(bool); ok {
|
||||
data.BYOKEnabled = v
|
||||
}
|
||||
}
|
||||
|
||||
// User Personas: check if user-created personas are enabled
|
||||
if raw, err := s.GlobalConfig.Get(ctx, "user_personas"); err == nil && raw != nil {
|
||||
if v, ok := raw["enabled"].(bool); ok {
|
||||
data.UserPersonasEnabled = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user