fix(diagnostic+brain): Sprachmodell-Einstellung auf runtime.json umgestellt
War kaputt nach OpenClaw-Abriss: handleGetModel/handleSetModel haben gegen
aria-core (dockerExec + node-script in den Container) gearbeitet, der gibt's
nicht mehr.
diagnostic/server.js
- handleGetModel/handleSetModel lesen/schreiben jetzt brainModel in
/shared/config/runtime.json
- RUNTIME_CONFIG_FIELDS um "brainModel" erweitert
- Tote Variante (findSettingsFile + base64-node-script) komplett raus
aria-brain/proxy_client.py
- Liest brainModel aus runtime.json beim Container-Start
- Fallback: BRAIN_MODEL env → "claude-sonnet-4" Default
- Bei Aenderung in Diagnostic: aria-brain restarten damit's greift
(Hinweis steht in der UI)
diagnostic/index.html
- Section "Model" → "Sprachmodell (Brain)"
- Hinweis-Block mit Default-Erklaerung und Restart-Hinweis
- Modelle: claude-sonnet-4 (default), claude-opus-4, claude-haiku-4-5
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+22
-21
@@ -65,6 +65,7 @@ const RUNTIME_CONFIG_FILE = "/shared/config/runtime.json";
|
||||
const RUNTIME_CONFIG_FIELDS = [
|
||||
"RVS_HOST", "RVS_PORT", "RVS_TLS", "RVS_TOKEN",
|
||||
"ARIA_AUTH_TOKEN", "WHISPER_MODEL", "WHISPER_LANGUAGE",
|
||||
"brainModel",
|
||||
];
|
||||
function readRuntimeConfig() {
|
||||
const envDefaults = {
|
||||
@@ -2164,42 +2165,42 @@ async function handleRestartSession(clientWs) {
|
||||
// Claude Code laeuft mit --dangerously-skip-permissions (Alles oder Nichts).
|
||||
// Root-Check wird via CLAUDE_CODE_BUBBLEWRAP=1 in docker-compose.yml umgangen.
|
||||
|
||||
// ── Einstellungen: Model ────────────────────────────────
|
||||
// ── Einstellungen: Model (Brain) ────────────────────────
|
||||
// Liest/schreibt brainModel in /shared/config/runtime.json — Brain liest
|
||||
// das beim Container-Start. Bei Aenderung: aria-brain restarten
|
||||
// (Einstellungen → Reparatur → 🚨 aria-brain neu).
|
||||
|
||||
async function handleGetModel(clientWs) {
|
||||
function handleGetModel(clientWs) {
|
||||
try {
|
||||
const raw = await dockerExec("aria-core", `echo $DEFAULT_MODEL`);
|
||||
clientWs.send(JSON.stringify({ type: "model_info", model: raw.trim(), info: "Aktuelles Model (ENV)" }));
|
||||
const cfg = readRuntimeConfig();
|
||||
const model = (cfg.brainModel || "").trim() || "claude-sonnet-4";
|
||||
clientWs.send(JSON.stringify({
|
||||
type: "model_info",
|
||||
model,
|
||||
info: "Brain-Model (runtime.json) — bei Aenderung: aria-brain restarten",
|
||||
}));
|
||||
} catch (err) {
|
||||
clientWs.send(JSON.stringify({ type: "model_info", error: err.message }));
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSetModel(clientWs, model) {
|
||||
function handleSetModel(clientWs, model) {
|
||||
if (!model || typeof model !== "string") {
|
||||
clientWs.send(JSON.stringify({ type: "model_info", error: "Kein Model angegeben" }));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Model in Settings speichern (OpenClaw liest das)
|
||||
const settingsPath = await findSettingsFile();
|
||||
const script = [
|
||||
'const fs=require("fs");',
|
||||
`const f="${settingsPath}";`,
|
||||
'let s={};try{s=JSON.parse(fs.readFileSync(f,"utf8"));}catch(e){}',
|
||||
`s.model=${JSON.stringify(model)};`,
|
||||
`const dir=f.substring(0,f.lastIndexOf("/"));`,
|
||||
'try{fs.mkdirSync(dir,{recursive:true});}catch(e){}',
|
||||
'fs.writeFileSync(f,JSON.stringify(s,null,2));',
|
||||
].join("");
|
||||
const b64 = Buffer.from(script).toString("base64");
|
||||
await dockerExec("aria-core", `echo ${b64} | base64 -d | node`);
|
||||
|
||||
clientWs.send(JSON.stringify({ type: "model_info", model, info: `Model auf "${model}" gesetzt (Neustart noetig)` }));
|
||||
log("info", "server", `Model gesetzt: ${model}`);
|
||||
writeRuntimeConfig({ brainModel: model.trim() });
|
||||
log("info", "server", `Brain-Model gesetzt: ${model.trim()}`);
|
||||
clientWs.send(JSON.stringify({
|
||||
type: "model_info",
|
||||
model: model.trim(),
|
||||
info: `Model auf "${model.trim()}" gesetzt — aria-brain neu starten damit's greift`,
|
||||
}));
|
||||
} catch (err) {
|
||||
clientWs.send(JSON.stringify({ type: "model_info", error: err.message }));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// OpenClaw-Config-Handler entfernt — aria-core ist raus.
|
||||
|
||||
Reference in New Issue
Block a user