v1.8.27: fix memory count — use urllib not httpx in stats endpoint

This commit is contained in:
2026-05-28 22:21:02 +00:00
parent c6deb42adb
commit efa9ffc762
+7 -4
View File
@@ -315,11 +315,14 @@ def stats():
cur.execute("SELECT COUNT(*) FROM books"); books = cur.fetchone()[0] 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 conversations"); convos = cur.fetchone()[0]
try: try:
mi = httpx.get("http://172.16.2.1:6333/collections/mem0_memory", timeout=2).json() import urllib.request, json as _json
memories = mi.get("result",{}).get("points_count",0) with urllib.request.urlopen("http://172.16.2.1:6333/collections/mem0_memory", timeout=2) as _r:
except: memories = 0 _mi = _json.loads(_r.read())
memories = _mi.get("result",{}).get("points_count", 0)
except Exception as _me:
memories = 0
except Exception as e: except Exception as e:
print(f"Stats db error: {e}") print(f"Stats db error: {e}", flush=True)
books = convos = memories = 0 books = convos = memories = 0
# Cache count # Cache count
cache_count = 0 cache_count = 0