fix: RAG IngestDirectory 跳过 persona.md 和 _index.md

避免人格文档在RAG检索中重复出现,persona.md已通过系统提示注入。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-22 20:26:28 +08:00
parent dbd89f39ab
commit cd053194a9
@@ -64,6 +64,12 @@ func (ks *KnowledgeStore) IngestDirectory(ctx context.Context) (int, error) {
if !isSupportedFile(ext) {
return nil
}
// Skip files that are injected elsewhere (persona.md → system prompt,
// _index.md → metadata only, not story content).
base := filepath.Base(path)
if base == "persona.md" || base == "_index.md" {
return nil
}
n, err := ks.IngestFile(ctx, path)
if err != nil {
return fmt.Errorf("ingest %s: %w", path, err)