Spaces:
Running
Running
| import os | |
| from supabase import create_client | |
| import sys | |
| sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
| from config import settings | |
| SUPABASE_URL = settings.SUPABASE_URL | |
| SUPABASE_KEY = settings.SUPABASE_KEY | |
| def main(): | |
| supabase = create_client(SUPABASE_URL, SUPABASE_KEY) | |
| print("=== CACHE AUDIT ===") | |
| cache = supabase.table('query_cache').select('question, response_text, hit_count').limit(5).execute() | |
| if not cache.data: | |
| print("Cache is empty.") | |
| else: | |
| for row in cache.data: | |
| print(f"Q: {row['question']} | Hits: {row['hit_count']}") | |
| print(f"A: {row['response_text'][:50]}...") | |
| print("\n=== DOCUMENT CHUNKS AUDIT ===") | |
| chunks = supabase.table('document_chunks').select('scheme_title, chunk_text').limit(3).execute() | |
| for row in chunks.data: | |
| print(f"Scheme: {row['scheme_title']}") | |
| print(f"Text: {row['chunk_text'][:100]}...") | |
| print("-" * 20) | |
| if __name__ == "__main__": | |
| main() | |