feat(memory): add OSS-to-Platform notices (#5494)

This commit is contained in:
youneshima
2026-06-13 18:34:20 +05:30
committed by GitHub
parent f322cf82b9
commit 3553fc79dd
29 changed files with 9694 additions and 33 deletions
+13 -1
View File
@@ -1,6 +1,7 @@
import json
import logging
import os
import tempfile
import uuid
from hashlib import sha256
@@ -34,10 +35,21 @@ def _load_config():
def _write_config(config):
"""Best-effort write of ~/.mem0/config.json. Never raises."""
path = _config_path()
temp_path = None
try:
with open(path, "w") as f:
os.makedirs(os.path.dirname(path), exist_ok=True)
with tempfile.NamedTemporaryFile("w", dir=os.path.dirname(path), delete=False) as f:
temp_path = f.name
json.dump(config, f, indent=4)
f.flush()
os.fsync(f.fileno())
os.replace(temp_path, path)
except Exception as e:
if temp_path:
try:
os.unlink(temp_path)
except OSError:
pass
_logger.debug("Failed to write mem0 config %s: %s", path, e)