Files
goclaw/internal/store/system_config_store.go
viettranx 651072a9ea feat(config): add system_configs DB table with per-tenant isolation and System Settings modal
- Add system_configs table (migration 029) with per-tenant key-value config
- Add SystemConfigStore interface with strict tenant isolation (no cross-tenant fallback)
- Add ApplySystemConfigs overlay: DB values → in-memory cfg at startup + after save
- Add System Settings modal (navbar gear icon) with 3 sections:
  - Embedding: verified 1536d models (OpenAI, OpenRouter, Mistral), custom verify endpoint
  - UX Behavior: tool_status, block_reply, intent_classify toggles
  - Pending Compaction: provider/model + threshold/keepRecent/maxTokens
- Fix block_reply label inversion: ON = delivers intermediate text (not suppresses)
- Fix embedding status endpoint to read from system_configs DB (not provider JSONB)
- Fix config page save to only sync current tenant (not all tenants)
- Fix bus event payload to use fresh context (prevent canceled request context)
- Remove config.json fallback for embedding provider/model resolution
- Add "More Config" link in modal footer to full config page
- Add i18n for system-settings namespace (en/vi/zh)
2026-03-24 16:01:02 +07:00

21 lines
932 B
Go

package store
import "context"
// SystemConfigStore manages per-tenant configuration settings.
// Non-secret, plain-text key-value pairs. Use ConfigSecretsStore for secrets.
//
// Resolution: tenant-specific → MasterTenantID fallback → not found.
// All entries are stored per tenant_id. No sentinel UUID.
type SystemConfigStore interface {
// Get returns the config value. Checks tenant-specific first, falls back to MasterTenantID.
Get(ctx context.Context, key string) (string, error)
// Set stores a config value for the current tenant (from context).
// Falls back to MasterTenantID if no tenant in context.
Set(ctx context.Context, key, value string) error
// Delete removes a config value for the current tenant.
Delete(ctx context.Context, key string) error
// List returns all configs visible to the current tenant (master merged with tenant overrides).
List(ctx context.Context) (map[string]string, error)
}