fix(config): treat a [[curators]] entry without enabled as on
This commit is contained in:
1 parent
2e7158a760
commit
a2ade2ee42
3 files changed
+16
-3
No files matched your search
@@ -40,7 +40,7 @@ func curatorDefinition() Definition {
|
||||
}
|
||||
|
||||
func CuratorDefinition(def config.CuratorDefinition) curator.Definition {
|
||||
return curator.Definition{Name: def.Name, Enabled: def.Enabled, Instructions: def.Instructions, Manifest: curator.Manifest{
|
||||
return curator.Definition{Name: def.Name, Enabled: def.Enabled == nil || *def.Enabled, Instructions: def.Instructions, Manifest: curator.Manifest{
|
||||
Interval: def.Interval.Std(), Cooldown: def.Cooldown.Std(), OnInput: def.OnInput, Tools: def.Tools, Skills: def.Skills, MemoryEngine: def.MemoryEngine, Conversations: def.Conversations, Model: def.Model,
|
||||
}}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package config
|
||||
|
||||
// CuratorDefinition is one [[curators]] entry. Interval is required.
|
||||
// CuratorDefinition is one [[curators]] entry. Interval is required. An entry
|
||||
// that omits enabled is on: writing one down is the intent to run it.
|
||||
type CuratorDefinition struct {
|
||||
Name string `toml:"name" yaml:"name" json:"name"`
|
||||
Enabled bool `toml:"enabled" yaml:"enabled" json:"enabled"`
|
||||
Enabled *bool `toml:"enabled" yaml:"enabled" json:"enabled"`
|
||||
Instructions string `toml:"instructions" yaml:"instructions" json:"instructions"`
|
||||
|
||||
Interval Duration `toml:"interval" yaml:"interval" json:"interval"`
|
||||
|
||||
@@ -68,6 +68,18 @@ func (l *Loader) applyDefaults(cfg *config.Config) {
|
||||
applyCaptureDefaults(cfg)
|
||||
applyNATSDefaults(cfg)
|
||||
applyMemoryDefaults(cfg)
|
||||
applyCuratorDefaults(cfg)
|
||||
}
|
||||
|
||||
// applyCuratorDefaults resolves an omitted enabled key to on, so the seeded
|
||||
// resource and the dashboard show the state the runtime applies.
|
||||
func applyCuratorDefaults(cfg *config.Config) {
|
||||
for i := range cfg.Curators {
|
||||
if cfg.Curators[i].Enabled == nil {
|
||||
on := true
|
||||
cfg.Curators[i].Enabled = &on
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// applyServiceDefaults fills each registered service's absent addresses from
|
||||
|
||||
Reference in new issue
Block a user