FA3-Datafetch/backend/scripts/check_alc_logs.py

26 lines
863 B
Python

import asyncio
import sys
import os
from sqlalchemy import select
# Add the parent directory to sys.path to allow imports from app
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from app.database import SessionLocal
from app.models import LLMUsageLog
async def check_alc_logs():
async with SessionLocal() as session:
# Search for logs where stock_code contains 'ALC' or prompt contains 'ALC'
# Since stock_code might be 'ALC' or similar.
stmt = select(LLMUsageLog).where(LLMUsageLog.id == 32)
result = await session.execute(stmt)
log = result.scalars().first()
if log:
print(f"ID: {log.id}, Used Google Search: {log.used_google_search}")
print(f"Prompt preview: {log.prompt[:200]}")
if __name__ == "__main__":
asyncio.run(check_alc_logs())