File size: 837 Bytes
af404c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
"""
Run from the backend directory:
    cd backend && python ../scripts/ingest.py [folder]

Examples:
    python ../scripts/ingest.py              # ingest all knowledge folders
    python ../scripts/ingest.py company      # ingest only /knowledge/company
    python ../scripts/ingest.py legal        # ingest only /knowledge/legal
"""
import sys
import logging
from pathlib import Path

# Add backend to path
sys.path.insert(0, str(Path(__file__).parent.parent / "backend"))

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s | %(levelname)-8s | %(message)s",
)

from app.services.ingestion_service import ingest_folder  # noqa: E402

folder = sys.argv[1] if len(sys.argv) > 1 else None
count, message = ingest_folder(folder)
print(f"\n✓ {message}")
print(f"  Total chunks indexed: {count}")