v3: Mission Control Self-Update + Guides-Copy + Button-Audit
- Neuer Self-Update-Button ("Mission Control aktualisieren"): POST /api/self-update
macht git pull (Quelle) -> rsync nach Prod -> systemctl restart (NOPASSWD).
Pfade aus config.py (SOURCE_DIR/PROD_DIR), nicht user-hartkodiert.
- "LLM-Engine aktualisieren" ehrlich (war MC, ist llama.cpp via MC_UPDATE_CMD).
- Guides: Kopier-Buttons fuer alle Configs + Codeblock (Copy-Paste-tauglich).
- Button-Audit: Funktionen/Labels in allen Panels geprueft, stimmig.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+57
-40
@@ -1,6 +1,15 @@
|
||||
// guides.js — Integrations-Anleitungen (v3): Copy-Paste-Configs für externe Tools.
|
||||
|
||||
import { $ } from "../core/ui.js";
|
||||
import { $, esc } from "../core/ui.js";
|
||||
|
||||
// In die Zwischenablage kopieren (kopiert das vorhergehende Eingabefeld / Codeblock).
|
||||
window.mcCopy = (btn, sel) => {
|
||||
const src = sel ? btn.parentElement.querySelector(sel) : btn.previousElementSibling;
|
||||
const text = src.value !== undefined ? src.value : src.textContent;
|
||||
navigator.clipboard?.writeText(text);
|
||||
const old = btn.textContent; btn.textContent = "Kopiert!";
|
||||
setTimeout(() => (btn.textContent = old), 1200);
|
||||
};
|
||||
|
||||
// Basis-URL aus dem Browser ableiten (zeigt die echte Bosgame-Adresse statt localhost).
|
||||
function apiBase() {
|
||||
@@ -8,46 +17,20 @@ function apiBase() {
|
||||
return `${location.protocol}//${host}:8080/v1`;
|
||||
}
|
||||
|
||||
// Beschriftetes Feld mit Kopier-Button.
|
||||
function field(label, value) {
|
||||
return `<label>${label}</label>
|
||||
<div class="flex gap-2" style="align-items:stretch;margin-bottom:12px">
|
||||
<input class="mono-sm" readonly value="${esc(value)}" style="flex:1;margin:0">
|
||||
<button class="ghost" onclick="window.mcCopy(this)">Kopieren</button>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function render() {
|
||||
const c = $(".view[data-view='guides']");
|
||||
if (!c) return;
|
||||
const url = apiBase();
|
||||
c.innerHTML = `
|
||||
<div class="pagehead"><div>
|
||||
<h1>Guides & Integrationen</h1>
|
||||
<div class="sub">Binde deine lokalen Modelle in andere Tools ein — fertige Configs zum Kopieren.</div></div></div>
|
||||
|
||||
<div class="card" style="padding:0;overflow:hidden">
|
||||
<details class="guide-acc">
|
||||
<summary>Cline / Cursor</summary>
|
||||
<div class="acc-body">
|
||||
<p>Nutze deine lokalen Modelle kostenlos in Cursor oder Cline (Provider: „OpenAI Compatible").</p>
|
||||
<label>Modell-ID</label>
|
||||
<input class="mono-sm" readonly value="coder">
|
||||
<label>Basis-URL (OpenAI-kompatibel)</label>
|
||||
<input class="mono-sm" readonly value="${url}">
|
||||
<label>API-Key</label>
|
||||
<input class="mono-sm" readonly value="(dein Token oder leer lassen)">
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="guide-acc">
|
||||
<summary>OpenWebUI</summary>
|
||||
<div class="acc-body">
|
||||
<p>Settings → Admin → Connections → neue OpenAI-Verbindung:</p>
|
||||
<label>Basis-URL</label>
|
||||
<input class="mono-sm" readonly value="${url}">
|
||||
<label>API-Key</label>
|
||||
<input class="mono-sm" readonly value="dummy-key">
|
||||
<p class="hint" style="margin-top:10px">OpenWebUI erkennt automatisch, wenn ein Modell getauscht wird.</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="guide-acc">
|
||||
<summary>Python / LangChain (openai-SDK)</summary>
|
||||
<div class="acc-body">
|
||||
<p>Mit dem offiziellen <code>openai</code>-Paket:</p>
|
||||
<div class="log" style="max-height:none"><code>from openai import OpenAI
|
||||
const py = `from openai import OpenAI
|
||||
|
||||
client = OpenAI(
|
||||
base_url="${url}",
|
||||
@@ -58,7 +41,42 @@ resp = client.chat.completions.create(
|
||||
model="coder", # Alias aus dem Cookbook
|
||||
messages=[{"role": "user", "content": "Hallo Modell!"}]
|
||||
)
|
||||
print(resp.choices[0].message.content)</code></div>
|
||||
print(resp.choices[0].message.content)`;
|
||||
|
||||
c.innerHTML = `
|
||||
<div class="pagehead"><div>
|
||||
<h1>Guides & Integrationen</h1>
|
||||
<div class="sub">Binde deine lokalen Modelle in andere Tools ein — fertige Configs zum Kopieren.</div></div></div>
|
||||
|
||||
<div class="card" style="padding:0;overflow:hidden">
|
||||
<details class="guide-acc">
|
||||
<summary>Cline / Cursor</summary>
|
||||
<div class="acc-body">
|
||||
<p>Nutze deine lokalen Modelle kostenlos in Cursor oder Cline (Provider: „OpenAI Compatible").</p>
|
||||
${field("Modell-ID", "coder")}
|
||||
${field("Basis-URL (OpenAI-kompatibel)", url)}
|
||||
${field("API-Key", "(dein Token oder leer lassen)")}
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="guide-acc">
|
||||
<summary>OpenWebUI</summary>
|
||||
<div class="acc-body">
|
||||
<p>Settings → Admin → Connections → neue OpenAI-Verbindung:</p>
|
||||
${field("Basis-URL", url)}
|
||||
${field("API-Key", "dummy-key")}
|
||||
<p class="hint" style="margin-top:10px">OpenWebUI erkennt automatisch, wenn ein Modell getauscht wird.</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="guide-acc">
|
||||
<summary>Python / LangChain (openai-SDK)</summary>
|
||||
<div class="acc-body">
|
||||
<p>Mit dem offiziellen <code>openai</code>-Paket:</p>
|
||||
<div style="position:relative">
|
||||
<button class="ghost" style="position:absolute;top:8px;right:8px;z-index:1" onclick="window.mcCopy(this,'code')">Kopieren</button>
|
||||
<div class="log" style="max-height:none"><code>${esc(py)}</code></div>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
@@ -66,8 +84,7 @@ print(resp.choices[0].message.content)</code></div>
|
||||
<summary>n8n (AI-Agent-Nodes)</summary>
|
||||
<div class="acc-body">
|
||||
<p>„OpenAI Chat Model"-Node → Credentials → Custom URL:</p>
|
||||
<label>Basis-URL</label>
|
||||
<input class="mono-sm" readonly value="${url}">
|
||||
${field("Basis-URL", url)}
|
||||
<p class="hint" style="margin-top:10px">Modell-ID „coder" eintragen und loslegen.</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user