feat: simplify SOP to immediate-effect configuration

This commit is contained in:
Eric 1549169735@qq.com
2026-08-18 16:27:02 +08:00
parent c5ab886b70
commit 8de48fb05e
150 changed files with 6764 additions and 1626 deletions

View File

@@ -72,6 +72,34 @@ func TestLoadProductionRequiresEnvironmentSecrets(t *testing.T) {
}
}
func TestLoadMultiTableEnvironmentConfiguration(t *testing.T) {
dir := writeConfigs(t, "")
t.Setenv("APP_MULTITABLE_ENABLED", "true")
t.Setenv("APP_MULTITABLE_API_KEY", "test-key")
for key, value := range map[string]string{
"APP_MULTITABLE_TABLES_SCENARIOS": "46",
"APP_MULTITABLE_TABLES_SCENARIO_FIELDS": "47",
"APP_MULTITABLE_TABLES_SCENARIO_RULES": "54",
"APP_MULTITABLE_TABLES_SOP_VERSIONS": "48",
"APP_MULTITABLE_TABLES_SOP_NODES": "49",
"APP_MULTITABLE_TABLES_SOP_EDGES": "50",
"APP_MULTITABLE_TABLES_KNOWLEDGE_VERSIONS": "51",
"APP_MULTITABLE_TABLES_KNOWLEDGE_ITEMS": "55",
"APP_MULTITABLE_TABLES_KNOWLEDGE_RELATIONS": "56",
"APP_MULTITABLE_TABLES_RUNS": "52",
"APP_MULTITABLE_TABLES_FEEDBACK": "53",
} {
t.Setenv(key, value)
}
cfg, err := Load(LoadOptions{ConfigDir: dir})
if err != nil {
t.Fatalf("Load() error = %v", err)
}
if !cfg.MultiTable.Enabled || cfg.MultiTable.Tables.Scenarios != 46 || cfg.MultiTable.Tables.ScenarioRules != 54 || cfg.MultiTable.Tables.KnowledgeItems != 55 || cfg.MultiTable.Tables.KnowledgeRelations != 56 || cfg.MultiTable.Tables.Feedback != 53 {
t.Fatalf("unexpected multitable configuration: %+v", cfg.MultiTable)
}
}
func writeConfigs(t *testing.T, profile string) string {
t.Helper()
dir := t.TempDir()