- InfoEndpoint: EmbeddingService injiziert, embeddingAvailable in /api/info Response - title.js: _showEmbeddingWarning() Modal via _createModal() wenn Modell fehlt - base.css: ol margin-left wie ul (geordnete Listen)
37 lines
1.7 KiB
JavaScript
37 lines
1.7 KiB
JavaScript
let buildTime = 0;
|
||
let serverIsWindows = false;
|
||
|
||
fetch('/api/info').then(r => r.json()).then(data => {
|
||
buildTime = data.buildTime || 0;
|
||
serverIsWindows = !!data.isWindows;
|
||
updateTitle();
|
||
setInterval(updateTitle, 1000);
|
||
if (data.embeddingAvailable === false) _showEmbeddingWarning();
|
||
});
|
||
|
||
function _showEmbeddingWarning() {
|
||
const { body } = _createModal('⚠️ Embedding-Modell nicht gefunden');
|
||
body.style.lineHeight = '1.7';
|
||
body.innerHTML =
|
||
'<p>Das Embedding-Modell <strong>all-MiniLM-L6-v2</strong> wurde nicht gefunden. ' +
|
||
'Ohne dieses Modell ist die semantische Suche (<code>memory_search</code>) deaktiviert.</p>' +
|
||
'<h3>So richtest du es ein:</h3>' +
|
||
'<ol>' +
|
||
'<li>Lade das Modell herunter: <a href="https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2" target="_blank">HuggingFace – all-MiniLM-L6-v2</a></li>' +
|
||
'<li>Benötigte Dateien: <code>model.onnx</code> und <code>vocab.txt</code></li>' +
|
||
'<li>Lege sie ab unter:<br><code>data/models/all-MiniLM-L6-v2/model.onnx</code><br><code>data/models/all-MiniLM-L6-v2/vocab.txt</code></li>' +
|
||
'<li>Starte den Server neu</li>' +
|
||
'</ol>';
|
||
}
|
||
|
||
function updateTitle() {
|
||
if (!buildTime) { document.title = '// gott'; return; }
|
||
const s = Math.floor(Date.now() / 1000) - buildTime;
|
||
let ago;
|
||
if (s < 60) ago = `${s} Sekunde${s !== 1 ? 'n' : ''}`;
|
||
else if (s < 3600) { const m = Math.floor(s / 60); ago = `${m} Minute${m !== 1 ? 'n' : ''}`; }
|
||
else if (s < 86400) { const h = Math.floor(s / 3600); ago = `${h} Stunde${h !== 1 ? 'n' : ''}`; }
|
||
else { const d = Math.floor(s / 86400); ago = `${d} Tag${d !== 1 ? 'en' : ''}`; }
|
||
document.title = `// gott :: Build vor ${ago}`;
|
||
}
|