Files
goclaw/migrations/000029_system_configs.up.sql
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

13 lines
587 B
SQL

-- system_configs: centralized key-value store for per-tenant system settings.
-- Each tenant has its own config entries. Falls back to master tenant at app layer.
-- Plain TEXT value (not encrypted). Use config_secrets for secrets.
CREATE TABLE IF NOT EXISTS system_configs (
key VARCHAR(100) NOT NULL,
value TEXT NOT NULL,
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
PRIMARY KEY (key, tenant_id)
);
CREATE INDEX IF NOT EXISTS idx_system_configs_tenant ON system_configs(tenant_id);