from apps.editor.models import Project
from collections import Counter
p = Project.objects.get(pk=8)
logs = p.openai_transcription_logs.all()
print("total logs:", logs.count())
print("by kind/op/status:", Counter([(l.request_kind, l.operation_name, l.status) for l in logs]).most_common(30))
print("---ai_suggestions---")
for s in p.ai_suggestions.all().order_by("-created_at")[:10]:
    n = 0
    if isinstance(s.structured_response, dict):
        n = len(s.structured_response.get("alternatives") or [])
    print(s.id, "active=", s.is_active, s.created_at, "alts=", n)
