feat: AutoContext-Suche grundlegend verbessern + Embedding-Debug-Tool
Hybrid-Suche (Vektor + FTS5-Keyword), Recency-Boost, Query-Erweiterung (letzte 2-3 User-Messages), Chunk-Overlapping, FullText-Speicherung, konfigurierbares Embedding-Modell/MaxSeqLen, deduplizierter AutoContext- Code (Streaming + CLI shared), Admin-Diagnose-Seite mit Re-Embed-Funktion. Threshold von 0.45 auf 0.35 gesenkt (Hybrid-Suche ist präziser). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
be6d33691a
commit
3f2baa1639
14 files changed
+1103
-61
No files matched your search
@@ -10,8 +10,9 @@ using Microsoft.ML.OnnxRuntime.Tensors;
|
||||
namespace Gott.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Lokaler Embedding-Service basierend auf all-MiniLM-L6-v2 (ONNX).
|
||||
/// Lokaler Embedding-Service (ONNX). Standardmäßig all-MiniLM-L6-v2.
|
||||
/// Generiert 384-dimensionale Sentence-Embeddings für semantische Suche.
|
||||
/// Das Modellverzeichnis und die maximale Sequenzlänge sind konfigurierbar.
|
||||
/// </summary>
|
||||
public sealed class EmbeddingService : IDisposable
|
||||
{
|
||||
@@ -20,15 +21,20 @@ public sealed class EmbeddingService : IDisposable
|
||||
readonly int _clsId;
|
||||
readonly int _sepId;
|
||||
readonly int _unkId;
|
||||
readonly int _maxSeqLen = 128;
|
||||
readonly int _maxSeqLen;
|
||||
bool _disposed;
|
||||
|
||||
public bool IsAvailable { get; }
|
||||
public int Dimensions => 384;
|
||||
public string ModelName { get; }
|
||||
public bool CrossEncoderAvailable => false;
|
||||
|
||||
public EmbeddingService()
|
||||
public EmbeddingService(string modelDir = null, int maxSeqLen = 256)
|
||||
{
|
||||
var modelDir = Path.Combine(AppContext.BaseDirectory, "data", "models", "all-MiniLM-L6-v2");
|
||||
_maxSeqLen = maxSeqLen;
|
||||
if (modelDir == null)
|
||||
modelDir = Path.Combine(AppContext.BaseDirectory, "data", "models", "all-MiniLM-L6-v2");
|
||||
ModelName = Path.GetFileName(modelDir);
|
||||
var modelPath = Path.Combine(modelDir, "model.onnx");
|
||||
var vocabPath = Path.Combine(modelDir, "vocab.txt");
|
||||
|
||||
|
||||
Reference in new issue
Block a user