-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug_db.py
More file actions
30 lines (23 loc) · 923 Bytes
/
debug_db.py
File metadata and controls
30 lines (23 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import asyncio
from pymongo import MongoClient
from dotenv import load_dotenv
load_dotenv()
MONGO_URI = os.getenv("MONGODB_URI")
DB_NAME = os.getenv("MONGODB_DATABASE", "adk_sessions")
def check_history(thread_id):
print(f"Checking history for thread: {thread_id}")
client = MongoClient(MONGO_URI)
db = client[DB_NAME]
collection = db["chat_history"]
events = list(collection.find({"thread_id": thread_id}).sort("timestamp", 1))
print(f"Found {len(events)} events.")
for event in events:
print(f"[{event.get('timestamp')}] {event.get('event_type')}")
if event.get('event_type') == 'text_message_content':
payload = event.get('payload', {})
print(f" Delta: {payload.get('delta')}")
if __name__ == "__main__":
# Thread ID from the user's logs
THREAD_ID = "43c5e531-b9bd-4034-9540-b124f1d87ad6"
check_history(THREAD_ID)