feat: embedding model warning modal on frontend load

- 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)
This commit is contained in:
Meleki committed 2026-03-11 14:38:27 +01:00
1 parent f941eae00a
commit a646e695cd
3 files changed
+21 -3

No files matched your search

+4 -2
View File
@@ -1,6 +1,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using Gott.Services;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
@@ -14,7 +15,7 @@ public static class InfoEndpoint
app.MapGet("/api/info", HandleInfo); app.MapGet("/api/info", HandleInfo);
} }
private static IResult HandleInfo() private static IResult HandleInfo(EmbeddingService embeddingService)
{ {
var assembly = Assembly.GetExecutingAssembly(); var assembly = Assembly.GetExecutingAssembly();
var location = assembly.Location; var location = assembly.Location;
@@ -39,6 +40,7 @@ public static class InfoEndpoint
} }
var isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows); var isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
return Results.Json(new { buildTime, isWindows }); var embeddingAvailable = embeddingService.IsAvailable;
return Results.Json(new { buildTime, isWindows, embeddingAvailable });
} }
} }
+1 -1
View File
@@ -126,6 +126,6 @@ a:hover {
text-decoration: underline; text-decoration: underline;
} }
ul { ul, ol {
margin-left: 1.5em; margin-left: 1.5em;
} }
+16
View File
@@ -6,8 +6,24 @@ fetch('/api/info').then(r => r.json()).then(data => {
serverIsWindows = !!data.isWindows; serverIsWindows = !!data.isWindows;
updateTitle(); updateTitle();
setInterval(updateTitle, 1000); 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() { function updateTitle() {
if (!buildTime) { document.title = '// gott'; return; } if (!buildTime) { document.title = '// gott'; return; }
const s = Math.floor(Date.now() / 1000) - buildTime; const s = Math.floor(Date.now() / 1000) - buildTime;