added model list to proxy log in diagnostic server
This commit is contained in:
parent
c255a85ffb
commit
f0b4e586c0
|
|
@ -102,7 +102,12 @@
|
||||||
<span class="status-label" id="proxy-status">Nicht getestet</span>
|
<span class="status-label" id="proxy-status">Nicht getestet</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="error-text" id="proxy-error"></div>
|
<div class="error-text" id="proxy-error"></div>
|
||||||
<button class="btn secondary" id="btn-proxy-test" onclick="testProxyBtn()">Proxy testen</button>
|
<div id="proxy-models" style="margin-top:6px;display:none">
|
||||||
|
<div style="font-size:11px;color:#8888AA;margin-bottom:3px">Verfuegbare Modelle:</div>
|
||||||
|
<div id="proxy-models-list" style="font-size:12px;line-height:1.6"></div>
|
||||||
|
<div style="font-size:10px;color:#555570;margin-top:4px" id="proxy-models-hint"></div>
|
||||||
|
</div>
|
||||||
|
<button class="btn secondary" id="btn-proxy-test" onclick="testProxyBtn()" style="margin-top:6px">Proxy testen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -275,6 +280,7 @@
|
||||||
} else {
|
} else {
|
||||||
addChat('error', msg.error, 'Claude Proxy Fehler');
|
addChat('error', msg.error, 'Claude Proxy Fehler');
|
||||||
}
|
}
|
||||||
|
if (msg.models && msg.models.length) showProxyModels(msg.models);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msg.type === 'docker_logs') {
|
if (msg.type === 'docker_logs') {
|
||||||
|
|
@ -334,6 +340,7 @@
|
||||||
document.getElementById('proxy-status').textContent = STATUS_LABELS[proxy.status] || proxy.status;
|
document.getElementById('proxy-status').textContent = STATUS_LABELS[proxy.status] || proxy.status;
|
||||||
document.getElementById('proxy-error').textContent = proxy.lastError || '';
|
document.getElementById('proxy-error').textContent = proxy.lastError || '';
|
||||||
document.getElementById('btn-proxy-test').disabled = proxy.status === 'testing';
|
document.getElementById('btn-proxy-test').disabled = proxy.status === 'testing';
|
||||||
|
if (proxy.models && proxy.models.length) showProxyModels(proxy.models);
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
document.getElementById('btn-gw').disabled = gw.status !== 'connected';
|
document.getElementById('btn-gw').disabled = gw.status !== 'connected';
|
||||||
|
|
@ -403,6 +410,19 @@
|
||||||
autoScroll[tab] = true;
|
autoScroll[tab] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showProxyModels(models) {
|
||||||
|
const container = document.getElementById('proxy-models');
|
||||||
|
const list = document.getElementById('proxy-models-list');
|
||||||
|
const hint = document.getElementById('proxy-models-hint');
|
||||||
|
container.style.display = 'block';
|
||||||
|
list.innerHTML = models.map(m => {
|
||||||
|
const clean = m.replace('openai/', '');
|
||||||
|
return `<div style="display:inline-block;background:#1E1E2E;border:1px solid #333;border-radius:4px;padding:2px 8px;margin:2px;font-size:11px">${escapeHtml(m)}</div>`;
|
||||||
|
}).join('');
|
||||||
|
const cleanNames = models.map(m => m.replace('openai/', ''));
|
||||||
|
hint.textContent = `DEFAULT_MODEL fuer docker-compose.yml: ${cleanNames.join(' | ')}`;
|
||||||
|
}
|
||||||
|
|
||||||
function escapeHtml(str) {
|
function escapeHtml(str) {
|
||||||
return str.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
return str.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -365,8 +365,14 @@ async function testProxy(prompt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const modelsData = await modelsRes.json();
|
const modelsData = await modelsRes.json();
|
||||||
const modelCount = modelsData.data?.length || 0;
|
const models = (modelsData.data || []).map(m => m.id).filter(Boolean);
|
||||||
log("info", "proxy", `Proxy erreichbar — ${modelCount} Model(s) verfuegbar`);
|
log("info", "proxy", `Proxy erreichbar — ${models.length} Model(s) verfuegbar`);
|
||||||
|
|
||||||
|
// Modellnamen loggen + OpenClaw-Config Hinweis
|
||||||
|
if (models.length > 0) {
|
||||||
|
log("info", "proxy", `Modelle: ${models.join(", ")}`);
|
||||||
|
log("info", "proxy", `Fuer docker-compose.yml (DEFAULT_MODEL): ${models.map(m => m.replace("openai/", "")).join(" | ")}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Schritt 2: Chat Completion testen (kurzer Prompt)
|
// Schritt 2: Chat Completion testen (kurzer Prompt)
|
||||||
const testPrompt = prompt || "Antworte mit genau einem Wort: Ping";
|
const testPrompt = prompt || "Antworte mit genau einem Wort: Ping";
|
||||||
|
|
@ -397,8 +403,9 @@ async function testProxy(prompt) {
|
||||||
|
|
||||||
state.proxy.status = "connected";
|
state.proxy.status = "connected";
|
||||||
state.proxy.lastError = null;
|
state.proxy.lastError = null;
|
||||||
|
state.proxy.models = models;
|
||||||
broadcastState();
|
broadcastState();
|
||||||
broadcast({ type: "proxy_result", ok: true, reply });
|
broadcast({ type: "proxy_result", ok: true, reply, models });
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log("error", "proxy", `Fehler: ${err.message}`);
|
log("error", "proxy", `Fehler: ${err.message}`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue