diff --git a/Endpoints/InfoEndpoint.cs b/Endpoints/InfoEndpoint.cs index 7f17dc5..15a7436 100644 --- a/Endpoints/InfoEndpoint.cs +++ b/Endpoints/InfoEndpoint.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Reflection; +using Gott.Services; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; @@ -14,7 +15,7 @@ public static class InfoEndpoint app.MapGet("/api/info", HandleInfo); } - private static IResult HandleInfo() + private static IResult HandleInfo(EmbeddingService embeddingService) { var assembly = Assembly.GetExecutingAssembly(); var location = assembly.Location; @@ -39,6 +40,7 @@ public static class InfoEndpoint } 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 }); } } diff --git a/wwwroot/css/base.css b/wwwroot/css/base.css index 7bdc7da..afa605c 100644 --- a/wwwroot/css/base.css +++ b/wwwroot/css/base.css @@ -126,6 +126,6 @@ a:hover { text-decoration: underline; } -ul { +ul, ol { margin-left: 1.5em; } diff --git a/wwwroot/js/title.js b/wwwroot/js/title.js index 198fc9f..379879c 100644 --- a/wwwroot/js/title.js +++ b/wwwroot/js/title.js @@ -6,8 +6,24 @@ fetch('/api/info').then(r => r.json()).then(data => { 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 = + '

Das Embedding-Modell all-MiniLM-L6-v2 wurde nicht gefunden. ' + + 'Ohne dieses Modell ist die semantische Suche (memory_search) deaktiviert.

' + + '

So richtest du es ein:

' + + '
    ' + + '
  1. Lade das Modell herunter: HuggingFace – all-MiniLM-L6-v2
  2. ' + + '
  3. Benötigte Dateien: model.onnx und vocab.txt
  4. ' + + '
  5. Lege sie ab unter:
    data/models/all-MiniLM-L6-v2/model.onnx
    data/models/all-MiniLM-L6-v2/vocab.txt
  6. ' + + '
  7. Starte den Server neu
  8. ' + + '
'; +} + function updateTitle() { if (!buildTime) { document.title = '// gott'; return; } const s = Math.floor(Date.now() / 1000) - buildTime;