v1.8.27: fix memory count — use urllib not httpx in stats endpoint
This commit is contained in:
@@ -315,11 +315,14 @@ def stats():
|
||||
cur.execute("SELECT COUNT(*) FROM books"); books = cur.fetchone()[0]
|
||||
cur.execute("SELECT COUNT(*) FROM conversations"); convos = cur.fetchone()[0]
|
||||
try:
|
||||
mi = httpx.get("http://172.16.2.1:6333/collections/mem0_memory", timeout=2).json()
|
||||
memories = mi.get("result",{}).get("points_count",0)
|
||||
except: memories = 0
|
||||
import urllib.request, json as _json
|
||||
with urllib.request.urlopen("http://172.16.2.1:6333/collections/mem0_memory", timeout=2) as _r:
|
||||
_mi = _json.loads(_r.read())
|
||||
memories = _mi.get("result",{}).get("points_count", 0)
|
||||
except Exception as _me:
|
||||
memories = 0
|
||||
except Exception as e:
|
||||
print(f"Stats db error: {e}")
|
||||
print(f"Stats db error: {e}", flush=True)
|
||||
books = convos = memories = 0
|
||||
# Cache count
|
||||
cache_count = 0
|
||||
|
||||
Reference in New Issue
Block a user