fix: glm not found in dotfiles-less workers — bridge promotes models.json.fallback at startup (the fallback was never read by anything)
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
// web prompts through pi.sendUserMessage. This process just hosts the session.
|
// web prompts through pi.sendUserMessage. This process just hosts the session.
|
||||||
// Global npm layout: resolve pi via absolute path (NODE_PATH does not apply to ESM).
|
// Global npm layout: resolve pi via absolute path (NODE_PATH does not apply to ESM).
|
||||||
import { spawn } from "node:child_process";
|
import { spawn } from "node:child_process";
|
||||||
import { existsSync } from "node:fs";
|
import { copyFileSync, existsSync } from "node:fs";
|
||||||
import {
|
import {
|
||||||
createAgentSession,
|
createAgentSession,
|
||||||
ModelRuntime,
|
ModelRuntime,
|
||||||
@@ -61,6 +61,13 @@ process.on("unhandledRejection", (err) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await runRepoSetup();
|
await runRepoSetup();
|
||||||
|
// Dotfiles-less bakes ship only models.json.fallback: promote it so the
|
||||||
|
// registry always resolves the zai provider (glm) instead of "not found".
|
||||||
|
const piAgent = "/root/.pi/agent";
|
||||||
|
if (!existsSync(`${piAgent}/models.json`) && existsSync(`${piAgent}/models.json.fallback`)) {
|
||||||
|
copyFileSync(`${piAgent}/models.json.fallback`, `${piAgent}/models.json`);
|
||||||
|
console.error("[lvmh-bridge] promoted models.json.fallback -> models.json");
|
||||||
|
}
|
||||||
// Optional initial model: LVMH_MODEL="provider/model-id" from the spawn
|
// Optional initial model: LVMH_MODEL="provider/model-id" from the spawn
|
||||||
// request. Resolved against the session's model registry; a bad value is
|
// request. Resolved against the session's model registry; a bad value is
|
||||||
// logged and falls back to the default model.
|
// logged and falls back to the default model.
|
||||||
|
|||||||
Reference in New Issue
Block a user