feat: support memory import and export (#1521)

* feat: support memory import and export

* fix(memory): address review feedback

* style: format memory settings page

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
Admire
2026-03-30 17:25:47 +08:00
committed by GitHub
parent 2330c38209
commit 9a557751d6
14 changed files with 604 additions and 27 deletions
+15
View File
@@ -145,6 +145,13 @@ class TestConfigQueries:
mock_mem.assert_called_once()
assert result == memory
def test_export_memory(self, client):
memory = {"version": "1.0", "facts": []}
with patch("deerflow.agents.memory.updater.get_memory_data", return_value=memory) as mock_mem:
result = client.export_memory()
mock_mem.assert_called_once()
assert result == memory
# ---------------------------------------------------------------------------
# stream / chat
@@ -661,6 +668,14 @@ class TestSkillsManagement:
class TestMemoryManagement:
def test_import_memory(self, client):
imported = {"version": "1.0", "facts": []}
with patch("deerflow.agents.memory.updater.import_memory_data", return_value=imported) as mock_import:
result = client.import_memory(imported)
mock_import.assert_called_once_with(imported)
assert result == imported
def test_reload_memory(self, client):
data = {"version": "1.0", "facts": []}
with patch("deerflow.agents.memory.updater.reload_memory_data", return_value=data):