This repository has been archived on 2026-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
ollie-core/agent/compaction.go

28 lines
727 B
Go

package agent
import "os"
// backendNamer is the subset of backend.Backend needed for model resolution.
type backendNamer interface {
Name() string
}
// resolveCompactionModel returns the model to use for compaction.
// Priority: agent config > OLLIE_COMPACTION_MODEL env > per-backend default from models.yaml > session's current model.
// Returns "" if no override is configured (use the session's current model).
func resolveCompactionModel(cfgModel string, b backendNamer) string {
if cfgModel != "" {
return cfgModel
}
if env := os.Getenv("OLLIE_COMPACTION_MODEL"); env != "" {
return env
}
cfg := loadModelsConfig()
if b != nil {
if m, ok := cfg.Compaction[b.Name()]; ok {
return m
}
}
return ""
}