Add memory system session context API

This commit is contained in:
2026-05-26 12:24:56 +08:00
parent d73f59f38d
commit a89807b174
10 changed files with 358 additions and 2 deletions

View File

@ -72,6 +72,68 @@ curl -s -X POST <MEMORY_SYSTEM_BASE_URL>/memory-system/sessions/<SESSION_ID>/ext
-d '{"user_id": "<USER_ID>", "user_key": "<USER_KEY>"}'
```
## Session Context
Use this when the caller needs the OpenViking working-memory context for one session plus related EverOS recall for the same user/session.
```bash
curl -s -X POST <MEMORY_SYSTEM_BASE_URL>/memory-system/sessions/<SESSION_ID>/context \
-H "Content-Type: application/json" \
-d '{
"user_id": "<USER_ID>",
"user_key": "<USER_KEY>",
"query": "我喜欢喝什么?",
"limit": 10
}'
```
Equivalent GET form:
```bash
curl -s "<MEMORY_SYSTEM_BASE_URL>/memory-system/sessions/<SESSION_ID>/context?user_id=<USER_ID>&user_key=<USER_KEY>&query=我喜欢喝什么?&limit=10"
```
Response shape:
```json
{
"status": "success",
"context": {
"latest_archive_overview": "# Working Memory\n...",
"pre_archive_abstracts": [],
"messages": [],
"estimatedTokens": 342,
"stats": {"totalArchives": 3}
},
"items": [
{
"source_backend": "everos",
"memory_type": "episode",
"id": "episode-1",
"summary": "userB 在对话中表示自己喜欢拿铁。",
"score": 0.72
}
],
"backends": {
"openviking": {
"status": "success",
"result": {
"status": "ok",
"estimatedTokens": 342,
"has_latest_archive_overview": true,
"message_count": 0
}
},
"everos": {
"status": "success",
"result": {
"counts": {"episodes": 1, "profiles": 0, "raw_messages": 0}
}
}
}
}
```
## Search
Without LLM planning: