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:
+11
-1
@@ -25,6 +25,7 @@ const (
|
|||||||
|
|
||||||
envSettingsFile string = "LVMH_SETTINGS_FILE"
|
envSettingsFile string = "LVMH_SETTINGS_FILE"
|
||||||
defaultSettingsFile string = "/app/build/docker/pi-agent/settings.json"
|
defaultSettingsFile string = "/app/build/docker/pi-agent/settings.json"
|
||||||
|
defaultBakedModelsFile string = "/app/build/docker/pi-agent/models.json"
|
||||||
envModelsFile string = "LVMH_MODELS_FILE"
|
envModelsFile string = "LVMH_MODELS_FILE"
|
||||||
defaultModelsFile string = "/app/build/docker/worker-models.json"
|
defaultModelsFile string = "/app/build/docker/worker-models.json"
|
||||||
|
|
||||||
@@ -568,7 +569,16 @@ func parseEnabledModels(data []byte) []ModelCatalogItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleModelCatalog(w http.ResponseWriter, r *http.Request) {
|
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 {
|
if err != nil {
|
||||||
writeError(w, http.StatusInternalServerError, "model catalog unavailable: "+err.Error())
|
writeError(w, http.StatusInternalServerError, "model catalog unavailable: "+err.Error())
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ if [ ! -f "$SRC/settings.json" ]; then
|
|||||||
fi
|
fi
|
||||||
rsync -a --delete \
|
rsync -a --delete \
|
||||||
--exclude 'auth.json' \
|
--exclude 'auth.json' \
|
||||||
--exclude 'models.json' \
|
|
||||||
--exclude 'models-store.json' \
|
--exclude 'models-store.json' \
|
||||||
--exclude 'sessions/' \
|
--exclude 'sessions/' \
|
||||||
--exclude 'cache/' \
|
--exclude 'cache/' \
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ RUN rm -f /usr/local/bin/npm \
|
|||||||
# Same pi config as workers (dotfiles, filtered; git: packages stripped).
|
# Same pi config as workers (dotfiles, filtered; git: packages stripped).
|
||||||
COPY docker/pi-agent/ /root/.pi/agent/
|
COPY docker/pi-agent/ /root/.pi/agent/
|
||||||
COPY plugin/lvmh-agent.ts /root/.pi/agent/extensions/lvmh-agent.ts
|
COPY plugin/lvmh-agent.ts /root/.pi/agent/extensions/lvmh-agent.ts
|
||||||
COPY docker/worker-models.json /root/.pi/agent/models.json
|
COPY docker/worker-models.json /root/.pi/agent/models.json.fallback
|
||||||
|
|
||||||
# Ops instructions live in the workspace (AGENTS.md is auto-loaded from cwd).
|
# Ops instructions live in the workspace (AGENTS.md is auto-loaded from cwd).
|
||||||
COPY docker/ops-context/AGENTS.md /ops-seed/AGENTS.md
|
COPY docker/ops-context/AGENTS.md /ops-seed/AGENTS.md
|
||||||
|
|||||||
@@ -25,15 +25,16 @@ RUN rm -f /usr/local/bin/npm \
|
|||||||
&& mv /usr/local/bin/npm-ignore-scripts /usr/local/bin/npm \
|
&& mv /usr/local/bin/npm-ignore-scripts /usr/local/bin/npm \
|
||||||
&& chmod +x /usr/local/bin/npm-real /usr/local/bin/npm
|
&& chmod +x /usr/local/bin/npm-real /usr/local/bin/npm
|
||||||
|
|
||||||
|
COPY docker/worker-models.json /root/.pi/agent/models.json.fallback
|
||||||
# User's pi config from dotfiles (settings, skills, agents, extensions,
|
# User's pi config from dotfiles (settings, skills, agents, extensions,
|
||||||
# APPEND_SYSTEM.md) — synced by deploy.sh from ~/.dotfiles/pi/agent (filtered:
|
# APPEND_SYSTEM.md) — synced by deploy.sh from ~/.dotfiles/pi/agent (filtered:
|
||||||
# no auth.json/sessions/cache/npm). If docker/pi-agent/ is absent this layer
|
# no auth.json/sessions/cache/npm). If docker/pi-agent/ is absent this layer
|
||||||
# is skipped (mkdir keeps later COPY targets valid).
|
# is skipped (mkdir keeps later COPY targets valid).
|
||||||
COPY docker/pi-agent/ /root/.pi/agent/
|
COPY docker/pi-agent/ /root/.pi/agent/
|
||||||
|
|
||||||
# lvmh overlays: dial-home plugin + env-ref models.json win over dotfiles copies.
|
# lvmh overlays: dial-home plugin; models.json comes from dotfiles (baked
|
||||||
|
# by rsync-pi-agent.sh; the .fallback above covers a dotfiles-less bake).
|
||||||
COPY plugin/lvmh-agent.ts /root/.pi/agent/extensions/lvmh-agent.ts
|
COPY plugin/lvmh-agent.ts /root/.pi/agent/extensions/lvmh-agent.ts
|
||||||
COPY docker/worker-models.json /root/.pi/agent/models.json
|
|
||||||
COPY docker/bridge /bridge
|
COPY docker/bridge /bridge
|
||||||
|
|
||||||
# Per-session pi sessions persist here (volume lvmh-sessions); package cache
|
# Per-session pi sessions persist here (volume lvmh-sessions); package cache
|
||||||
|
|||||||
Reference in New Issue
Block a user