mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-08-28 05:25:33 +00:00
Merge d71c76b149 into f11d8c4620
This commit is contained in:
commit
43282ba554
2 changed files with 28 additions and 2 deletions
|
|
@ -179,7 +179,7 @@ class SupermemoryPipecatService(FrameProcessor):
|
|||
if self.session_id:
|
||||
add_params["custom_id"] = self.session_id
|
||||
|
||||
await self._supermemory_client.memories.add(**add_params)
|
||||
await self._supermemory_client.add(**add_params)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Error storing messages: {e}")
|
||||
|
|
|
|||
|
|
@ -120,4 +120,30 @@ class TestSupermemoryPipecatNullProfile(unittest.IsolatedAsyncioTestCase):
|
|||
"profile": {"static": [], "dynamic": []},
|
||||
"search_results": [],
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class _MockAddClient:
|
||||
"""a client that only exposes the top-level add, not memories.add."""
|
||||
|
||||
def __init__(self):
|
||||
self.add = AsyncMock(return_value=SimpleNamespace(id="doc_123"))
|
||||
|
||||
|
||||
class TestSupermemoryPipecatStoreMessages(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_store_messages_calls_top_level_add(self) -> None:
|
||||
# regression guard: supermemory 3.x moved add off client.memories to the
|
||||
# top level. _store_messages must call client.add, not client.memories.add.
|
||||
# the mock has no memories attribute, so a reverted call would raise,
|
||||
# get swallowed by the fire-and-forget block, and add would never fire.
|
||||
service = SupermemoryPipecatService(api_key="mock_key", user_id="user_123")
|
||||
client = _MockAddClient()
|
||||
service._supermemory_client = client
|
||||
|
||||
await service._store_messages([{"role": "user", "content": "hello"}])
|
||||
|
||||
client.add.assert_awaited_once()
|
||||
_, kwargs = client.add.await_args
|
||||
self.assertIn("content", kwargs)
|
||||
self.assertEqual(kwargs["container_tags"], ["user_123"])
|
||||
self.assertFalse(hasattr(client, "memories"))
|
||||
Loading…
Add table
Reference in a new issue