Skip to content

fix: ensure StreamMemory.search matches added docs (Fixes #59) - #60

Open
februarysea wants to merge 1 commit into
tsinghua-fib-lab:mainfrom
februarysea:fix/streammemory-none-bug
Open

fix: ensure StreamMemory.search matches added docs (Fixes #59)#60
februarysea wants to merge 1 commit into
tsinghua-fib-lab:mainfrom
februarysea:fix/streammemory-none-bug

Conversation

@februarysea

@februarysea februarysea commented Aug 30, 2025

Copy link
Copy Markdown

概要
修复了 StreamMemory.search 方法始终返回空结果的问题。

解决方案
在 add 方法中补充 "type": "stream" 标签,使 search 方法能够正确匹配并返回已存储的记忆。

复现结果对比
修复前:

2025-08-30 20:15:14,186 - Agent - INFO - agent1 search memories: Nothing
2025-08-30 20:15:14,186 - Agent - INFO - agent1 all memories: [{'id': 0, 'cognition_id': None, 'topic': 'Event', 'location': 500030808, 'description': 'I ate with my friend', 'day': 0, 't': 28801}, {'id': 1, 'cognition_id': None, 'topic': 'Event', 'location': 500030808, 'description': 'I met my friend', 'day': 0, 't': 28801}, {'id': 2, 'cognition_id': None, 'topic': 'Event', 'location': 500030808, 'description': 'I talked with my friend', 'day': 0, 't': 28801}, {'id': 3, 'cognition_id': None, 'topic': 'Event', 'location': 500030808, 'description': 'I met another friend', 'day': 0, 't': 28801}, {'id': 4, 'cognition_id': None, 'topic': 'Event', 'location': 500030808, 'description': 'I ate with another friend', 'day': 0, 't': 28801}]

修复后:

2025-08-30 20:21:57,207 - Agent - INFO - agent1 search memories: 
- [Event]: I talked with my friend [day: 0, time: 08:00:01, location: unknown]
- [Event]: I met my friend [day: 0, time: 08:00:01, location: unknown]
- [Event]: I ate with my friend [day: 0, time: 08:00:01, location: unknown]
- [Event]: I ate with another friend [day: 0, time: 08:00:01, location: unknown]
- [Event]: I met another friend [day: 0, time: 08:00:01, location: unknown]
2025-08-30 20:21:57,207 - Agent - INFO - agent1 all memories: [{'id': 0, 'cognition_id': None, 'topic': 'Event', 'location': 500024168, 'description': 'I ate with my friend', 'day': 0, 't': 28801}, {'id': 1, 'cognition_id': None, 'topic': 'Event', 'location': 500024168, 'description': 'I met my friend', 'day': 0, 't': 28801}, {'id': 2, 'cognition_id': None, 'topic': 'Event', 'location': 500024168, 'description': 'I talked with my friend', 'day': 0, 't': 28801}, {'id': 3, 'cognition_id': None, 'topic': 'Event', 'location': 500024168, 'description': 'I met another friend', 'day': 0, 't': 28801}, {'id': 4, 'cognition_id': None, 'topic': 'Event', 'location': 500024168, 'description': 'I ate with another friend', 'day': 0, 't': 28801}]

关联 Issue
#59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant