v1.8.25: fix memory count — read from Qdrant mem0_memory not empty PG table
This commit is contained in:
@@ -314,7 +314,10 @@ def stats():
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("SELECT COUNT(*) FROM books"); books = cur.fetchone()[0]
|
||||
cur.execute("SELECT COUNT(*) FROM conversations"); convos = cur.fetchone()[0]
|
||||
cur.execute("SELECT COUNT(*) FROM memory"); memories = cur.fetchone()[0]
|
||||
try:
|
||||
mi = httpx.get("http://qdrant:6333/collections/mem0_memory", timeout=2).json()
|
||||
memories = mi.get("result",{}).get("points_count",0)
|
||||
except: memories = 0
|
||||
except Exception as e:
|
||||
print(f"Stats db error: {e}")
|
||||
books = convos = memories = 0
|
||||
@@ -455,7 +458,10 @@ def admin_overview(_=Depends(require_admin)):
|
||||
with conn.cursor(cursor_factory=RealDictCursor) as cur:
|
||||
cur.execute("SELECT COUNT(*) as total FROM books"); books = cur.fetchone()["total"]
|
||||
cur.execute("SELECT COUNT(*) as total FROM conversations"); convos = cur.fetchone()["total"]
|
||||
cur.execute("SELECT COUNT(*) as total FROM memory"); memories = cur.fetchone()["total"]
|
||||
try:
|
||||
mi = httpx.get("http://qdrant:6333/collections/mem0_memory", timeout=2).json()
|
||||
memories = mi.get("result",{}).get("points_count",0)
|
||||
except: memories = 0
|
||||
cur.execute("SELECT COUNT(DISTINCT session_id) as total FROM conversations"); unique_users = cur.fetchone()["total"]
|
||||
cur.execute("SELECT llm_used, COUNT(*) as cnt FROM conversations GROUP BY llm_used ORDER BY cnt DESC")
|
||||
llm_usage = cur.fetchall()
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user