Spaces:
Sleeping
Sleeping
Commit Β·
b199600
1
Parent(s): 112b4f4
fix: clear both kb_meta.txt and kb_meta_brief.txt on every re-ingestion
Browse filesEnsures stale overview files are always overwritten, both in the normal
ingestion path and the no-files-found cleanup path.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- src/ingest.py +14 -4
src/ingest.py
CHANGED
|
@@ -196,10 +196,11 @@ def ingest_documents(cfg: dict = None, documents_dir: str = None) -> int:
|
|
| 196 |
if not os.path.isabs(db_path):
|
| 197 |
project_root = Path(__file__).resolve().parent.parent
|
| 198 |
db_path = os.path.join(str(project_root), db_path)
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
os.
|
| 202 |
-
|
|
|
|
| 203 |
except Exception as e:
|
| 204 |
print(f"Warning: Could not clear KB meta: {e}")
|
| 205 |
return 0
|
|
@@ -287,6 +288,15 @@ def ingest_documents(cfg: dict = None, documents_dir: str = None) -> int:
|
|
| 287 |
print(f"SQL ingestion error (non-fatal): {e}")
|
| 288 |
|
| 289 |
# ββ KB meta overview (LLM-generated) ββββββββββββββββββββββββββββ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
print("\nGenerating knowledge base overview...")
|
| 291 |
try:
|
| 292 |
from src.kb_meta import build_and_store_overview
|
|
|
|
| 196 |
if not os.path.isabs(db_path):
|
| 197 |
project_root = Path(__file__).resolve().parent.parent
|
| 198 |
db_path = os.path.join(str(project_root), db_path)
|
| 199 |
+
for meta_name in ("kb_meta.txt", "kb_meta_brief.txt"):
|
| 200 |
+
meta_file = os.path.join(db_path, meta_name)
|
| 201 |
+
if os.path.exists(meta_file):
|
| 202 |
+
os.remove(meta_file)
|
| 203 |
+
print("Cleared stale KB overview.")
|
| 204 |
except Exception as e:
|
| 205 |
print(f"Warning: Could not clear KB meta: {e}")
|
| 206 |
return 0
|
|
|
|
| 288 |
print(f"SQL ingestion error (non-fatal): {e}")
|
| 289 |
|
| 290 |
# ββ KB meta overview (LLM-generated) ββββββββββββββββββββββββββββ
|
| 291 |
+
# Clear stale meta files before regenerating
|
| 292 |
+
_db_path = cfg.get("paths", {}).get("vector_db", "chroma_db")
|
| 293 |
+
if not os.path.isabs(_db_path):
|
| 294 |
+
_db_path = os.path.join(str(Path(__file__).resolve().parent.parent), _db_path)
|
| 295 |
+
for _meta_name in ("kb_meta.txt", "kb_meta_brief.txt"):
|
| 296 |
+
_meta_file = os.path.join(_db_path, _meta_name)
|
| 297 |
+
if os.path.exists(_meta_file):
|
| 298 |
+
os.remove(_meta_file)
|
| 299 |
+
|
| 300 |
print("\nGenerating knowledge base overview...")
|
| 301 |
try:
|
| 302 |
from src.kb_meta import build_and_store_overview
|