v1.8.28: fix memory count in admin/overview — httpx not in scope, use urllib

This commit is contained in:
2026-05-28 22:22:39 +00:00
parent efa9ffc762
commit 4dfd5918dc
+3 -2
View File
@@ -462,8 +462,9 @@ def admin_overview(_=Depends(require_admin)):
cur.execute("SELECT COUNT(*) as total FROM books"); books = cur.fetchone()["total"]
cur.execute("SELECT COUNT(*) as total FROM conversations"); convos = cur.fetchone()["total"]
try:
mi = httpx.get("http://172.16.2.1:6333/collections/mem0_memory", timeout=2).json()
memories = mi.get("result",{}).get("points_count",0)
import urllib.request, json as _j
with urllib.request.urlopen("http://172.16.2.1:6333/collections/mem0_memory", timeout=2) as _r:
memories = _j.loads(_r.read()).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")