mirror of
https://github.com/arkorty/B.Tech-Project-III.git
synced 2026-04-19 12:41:48 +00:00
init
This commit is contained in:
62
thirdeye/scripts/debug_signals.py
Normal file
62
thirdeye/scripts/debug_signals.py
Normal file
@@ -0,0 +1,62 @@
|
||||
"""
|
||||
Debug script to see what signals were extracted for a specific group.
|
||||
Shows the actual text stored in ChromaDB to help debug search issues.
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
from backend.db.chroma import get_all_signals
|
||||
import json
|
||||
|
||||
# Your Telegram group ID from the logs
|
||||
GROUP_ID = "-5180781849" # Binary_hacks_dev
|
||||
|
||||
print("=" * 80)
|
||||
print(f"Signals for group: {GROUP_ID} (Binary_hacks_dev)")
|
||||
print("=" * 80)
|
||||
|
||||
signals = get_all_signals(GROUP_ID)
|
||||
|
||||
if not signals:
|
||||
print("\n⚠️ No signals found for this group")
|
||||
print(" Either no messages processed yet, or wrong group ID")
|
||||
else:
|
||||
print(f"\nFound {len(signals)} total signals\n")
|
||||
|
||||
# Show last 10 signals (most recent)
|
||||
for i, sig in enumerate(signals[-10:], 1):
|
||||
meta = sig.get("metadata", {})
|
||||
doc = sig.get("document", "")
|
||||
|
||||
print(f"\n{'─' * 80}")
|
||||
print(f"Signal {i}/{len(signals)}")
|
||||
print(f"{'─' * 80}")
|
||||
print(f"Type: {meta.get('type', 'unknown')}")
|
||||
print(f"Severity: {meta.get('severity', 'unknown')}")
|
||||
print(f"Timestamp: {meta.get('timestamp', 'unknown')}")
|
||||
print(f"Entities: {meta.get('entities', '[]')}")
|
||||
print(f"Keywords: {meta.get('keywords', '[]')}")
|
||||
|
||||
# Parse entities and keywords from JSON
|
||||
try:
|
||||
entities = json.loads(meta.get('entities', '[]'))
|
||||
keywords = json.loads(meta.get('keywords', '[]'))
|
||||
print(f"\nEntities list: {entities}")
|
||||
print(f"Keywords list: {keywords}")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
print(f"\nDocument text:")
|
||||
print(f"{doc[:300]}...")
|
||||
|
||||
raw_quote = meta.get('raw_quote', '')
|
||||
if raw_quote:
|
||||
print(f"\nRaw quote:")
|
||||
print(f"{raw_quote[:300]}...")
|
||||
|
||||
print("\n" + "=" * 80)
|
||||
print("\nTo search for specific terms:")
|
||||
print(" from backend.db.chroma import query_signals")
|
||||
print(f" results = query_signals('{GROUP_ID}', 'your search query', n_results=5)")
|
||||
print("=" * 80)
|
||||
Reference in New Issue
Block a user