fix(model selection): bake dotfiles models.json (both glm models, env-ref key) over frozen worker list; catalog prefers baked file — was offering models the container registry couldn't resolve
This commit is contained in:
+15
-5
@@ -23,10 +23,11 @@ import (
|
||||
const (
|
||||
envToken string = "LVMH_TOKEN"
|
||||
|
||||
envSettingsFile string = "LVMH_SETTINGS_FILE"
|
||||
defaultSettingsFile string = "/app/build/docker/pi-agent/settings.json"
|
||||
envModelsFile string = "LVMH_MODELS_FILE"
|
||||
defaultModelsFile string = "/app/build/docker/worker-models.json"
|
||||
envSettingsFile string = "LVMH_SETTINGS_FILE"
|
||||
defaultSettingsFile string = "/app/build/docker/pi-agent/settings.json"
|
||||
defaultBakedModelsFile string = "/app/build/docker/pi-agent/models.json"
|
||||
envModelsFile string = "LVMH_MODELS_FILE"
|
||||
defaultModelsFile string = "/app/build/docker/worker-models.json"
|
||||
|
||||
defaultEventsAfter int64 = 0
|
||||
defaultEventsLimit int = 1000
|
||||
@@ -568,7 +569,16 @@ func parseEnabledModels(data []byte) []ModelCatalogItem {
|
||||
}
|
||||
|
||||
func (s *Server) handleModelCatalog(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := os.ReadFile(envOr(envModelsFile, defaultModelsFile))
|
||||
// Prefer the baked dotfiles models.json (full provider set, synced by
|
||||
// rsync-pi-agent.sh); fall back to the minimal frozen worker list.
|
||||
path := envOr(envModelsFile, "")
|
||||
if path == "" {
|
||||
path = defaultBakedModelsFile
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
path = defaultModelsFile
|
||||
}
|
||||
}
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
writeError(w, http.StatusInternalServerError, "model catalog unavailable: "+err.Error())
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user