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
@@ -23,6 +23,7 @@ public class EmbeddingBackgroundService : BackgroundService
|
||||
readonly ConcurrentQueue<EmbeddingJob> _queue = new();
|
||||
readonly SemaphoreSlim _signal = new(0);
|
||||
readonly string _dataPath;
|
||||
volatile bool _reEmbedRequested;
|
||||
|
||||
public EmbeddingBackgroundService(VectorSearchService vectorSearch, EmbeddingService embedding, string dbPath)
|
||||
{
|
||||
@@ -32,6 +33,13 @@ public class EmbeddingBackgroundService : BackgroundService
|
||||
_dataPath = Path.GetDirectoryName(dbPath);
|
||||
}
|
||||
|
||||
/// <summary>Triggers a full re-embedding of all data.</summary>
|
||||
public void TriggerReEmbed()
|
||||
{
|
||||
_reEmbedRequested = true;
|
||||
_signal.Release();
|
||||
}
|
||||
|
||||
/// <summary>Enqueue eine neue Message zum Embedden.</summary>
|
||||
public void Enqueue(long messageId, string chainId, string sessionId, string agentId, string role, string text)
|
||||
{
|
||||
@@ -85,6 +93,17 @@ public class EmbeddingBackgroundService : BackgroundService
|
||||
Console.WriteLine($"[EmbeddingBG] Error embedding job: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
// Check for re-embed request
|
||||
if (_reEmbedRequested)
|
||||
{
|
||||
_reEmbedRequested = false;
|
||||
Console.WriteLine("[EmbeddingBG] Re-embedding triggered...");
|
||||
await _vectorSearch.ReEmbedAllAsync();
|
||||
await BackfillAsync(ct);
|
||||
await BackfillMemoryFilesAsync(ct);
|
||||
Console.WriteLine("[EmbeddingBG] Re-embedding complete.");
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException) { break; }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user