* feat: add POST /api/v1/memory endpoint for realtime conversation memory
Add memory extraction API that accepts conversation messages and
stores them via Mem0. This enables realtime voice sessions to save
memories through the same pipeline as chat conversations.
Fixes: sparticleinc/mygpt-frontend#2126
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address code review findings for memory API
- Use Literal["user","assistant"] for role field validation
- Add Field constraints (min_length, max_length=200)
- Track and report pairs_failed in response
- Hide internal exception details from HTTP response
- Remove unused authorization parameter (internal API)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: zhuchao <zhuchaowe@163.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
EB API 始终返回人员最后已知坐标,不区分在馆/离馆。通过检查 last_communication_time
与当前时刻的差值(阈值5分钟/24小时),实现三级在離判定并提供对应的日语回答模板。
Closessparticleinc/mygpt-frontend#1963
Co-authored-by: zhuchao <zhuchaowe@163.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Mem0's get_all() returns data in format {"results": [...]}, not a direct list.
Also, agent_id is at the top level of each memory, not in metadata.
Changes:
- Add _extract_memories_from_response() to handle both new and old response formats
- Add _check_agent_id_match() to check agent_id at both top-level and in metadata
- Update get_all_memories, delete_memory, delete_all_memories to use new helpers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mem0's get_all() method may return a list containing either strings
(older version format) or dictionaries (newer version format). This
fix adds proper type checking to handle both cases gracefully.
- get_all_memories: Skip string items, only process dict items
- delete_memory: Add type checking before accessing dict methods
- delete_all_memories: Add type checking before accessing dict methods
Fixes: 'str' object has no attribute 'get' error
Co-authored-by: zhuchao <zhuchaowe@163.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>