Spaces:
Running
Running
Commit
·
c7d9d32
1
Parent(s):
a8e02fb
Upd save chunk sclicer
Browse files
memory.py
CHANGED
@@ -26,7 +26,9 @@ class MemoryManager:
|
|
26 |
# ---------- Public API ----------
|
27 |
def add_exchange(self, user_id: str, query: str, response: str, lang: str = "EN"):
|
28 |
self._touch_user(user_id)
|
29 |
-
self.text_cache[user_id].append((query.strip(), response.strip()))
|
|
|
|
|
30 |
# Avoid re-chunking identical response
|
31 |
cache_key = hashlib.md5((query + response).encode()).hexdigest()
|
32 |
if cache_key in self.chunk_cache:
|
|
|
26 |
# ---------- Public API ----------
|
27 |
def add_exchange(self, user_id: str, query: str, response: str, lang: str = "EN"):
|
28 |
self._touch_user(user_id)
|
29 |
+
self.text_cache[user_id].append(((query or "").strip(), (response or "").strip()))
|
30 |
+
if not response:
|
31 |
+
return []
|
32 |
# Avoid re-chunking identical response
|
33 |
cache_key = hashlib.md5((query + response).encode()).hexdigest()
|
34 |
if cache_key in self.chunk_cache:
|