Add memory management APIs for OpenViking: list, read, write, and delete memories
This commit is contained in:
@ -61,6 +61,10 @@ Base path: `/memory-system`
|
||||
| `POST` | `/sessions/{session_id}/extract` | Trigger OpenViking extract only | Yes |
|
||||
| `GET/POST` | `/sessions/{session_id}/context` | Read OpenViking session context plus EverOS recall | Yes |
|
||||
| `GET` | `/openviking/tasks/{task_id}` | Poll OpenViking task status | Yes |
|
||||
| `GET` | `/memories` | List OpenViking memory URIs under a memory root | Yes |
|
||||
| `GET` | `/memories/content` | Read one OpenViking memory URI | Yes |
|
||||
| `POST` | `/memories` | Create, replace, or append an OpenViking memory via `content/write` | Yes |
|
||||
| `DELETE` | `/memories` | Delete an OpenViking memory URI via `fs` | Yes |
|
||||
| `POST` | `/search` | Search OpenViking and EverOS | Yes |
|
||||
| `GET` | `/users/{user_id}/profile` | Read EverOS profile | Yes |
|
||||
|
||||
@ -147,6 +151,50 @@ GET with query parameters is also supported:
|
||||
curl -sS "$BASE/memory-system/sessions/sessionA1/context?user_id=userA&user_key=$USER_KEY&query=我喜欢喝什么?&limit=10"
|
||||
```
|
||||
|
||||
List memories:
|
||||
|
||||
```bash
|
||||
curl -sS -G "$BASE/memory-system/memories" \
|
||||
--data-urlencode "user_id=userA" \
|
||||
--data-urlencode "user_key=$USER_KEY" \
|
||||
--data-urlencode "uri=viking://user/memories" \
|
||||
--data-urlencode "recursive=true"
|
||||
```
|
||||
|
||||
Read memory:
|
||||
|
||||
```bash
|
||||
curl -sS -G "$BASE/memory-system/memories/content" \
|
||||
--data-urlencode "user_id=userA" \
|
||||
--data-urlencode "user_key=$USER_KEY" \
|
||||
--data-urlencode "uri=viking://user/memories/preferences/python.md"
|
||||
```
|
||||
|
||||
Create, replace, or append memory:
|
||||
|
||||
```bash
|
||||
curl -sS -X POST "$BASE/memory-system/memories" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"user_id": "userA",
|
||||
"user_key": "'"$USER_KEY"'",
|
||||
"uri": "viking://user/memories/preferences/python.md",
|
||||
"content": "# Python 偏好\n\n用户偏好使用 Python 做数据分析。",
|
||||
"mode": "replace",
|
||||
"wait": true
|
||||
}'
|
||||
```
|
||||
|
||||
Delete memory:
|
||||
|
||||
```bash
|
||||
curl -sS -X DELETE -G "$BASE/memory-system/memories" \
|
||||
--data-urlencode "user_id=userA" \
|
||||
--data-urlencode "user_key=$USER_KEY" \
|
||||
--data-urlencode "uri=viking://user/memories/preferences/python.md" \
|
||||
--data-urlencode "recursive=false"
|
||||
```
|
||||
|
||||
## Response Handling
|
||||
|
||||
Top-level `status` is one of:
|
||||
|
||||
Reference in New Issue
Block a user