feat(crumbforest): wire up docs, missions, and history indexer

This commit is contained in:
2025-12-27 15:17:58 +01:00
parent 64f568d5bc
commit b9f49c170c
6 changed files with 326 additions and 3 deletions

66
trigger_history_index.py Executable file
View File

@@ -0,0 +1,66 @@
#!/usr/bin/env python3
"""
Trigger History Indexing
Script to manually trigger indexing of chat history logs.
"""
import sys
import logging
from deps import get_db, get_qdrant_client
from config import get_settings
from services.provider_factory import ProviderFactory
from services.history_indexer import HistoryIndexer
# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def main():
print("=" * 60)
print("📜 Crumbforest Chat History Indexer")
print("=" * 60)
settings = get_settings()
# 1. Setup Provider
provider_name = settings.default_embedding_provider
print(f"✓ Using provider: {provider_name}")
try:
provider = ProviderFactory.create_provider(
provider_name=provider_name,
settings=settings
)
except Exception as e:
print(f"✗ Failed to create provider: {e}")
return False
# 2. Get Connections
try:
db = get_db()
qdrant = get_qdrant_client()
print("✓ Database & Qdrant connected")
except Exception as e:
print(f"✗ Connection failed: {e}")
return False
# 3. Run Indexer
indexer = HistoryIndexer(db, qdrant, provider)
print("⏳ Indexing history from /var/log/crumbforest/chat_history.jsonl...")
result = indexer.index_history()
print("-" * 60)
print(f"Indexed: {result.get('indexed')} entries")
print(f"Errors: {result.get('errors')} lines skipped")
print("-" * 60)
if result.get('indexed') > 0:
print("✅ History successfully planted in Qdrant!")
else:
print(" No new entries found (or file empty).")
return True
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)