更新文档,调整内存 URI 格式和写入模式示例;移除过时的 OpenViking 内容补充逻辑,并添加相应的单元测试
This commit is contained in:
23
README.md
23
README.md
@ -530,12 +530,27 @@ curl -sS -G "$API/memories/content" \
|
||||
|---|---|---:|---|
|
||||
| `user_id` | string | 是 | 用户 ID |
|
||||
| `user_key` | string | 是 | `/users` 返回的 user key |
|
||||
| `uri` | string | 是 | 目标 memory URI,例如 `viking://user/memories/profile.md` |
|
||||
| `uri` | string | 是 | 目标 memory URI,例如 `viking://user/userA/memories/preferences/饮食偏好.md` |
|
||||
| `content` | string | 是 | 要写入的 Markdown/text 内容 |
|
||||
| `mode` | `create`/`replace`/`append` | 否 | 写入模式,默认 `create` |
|
||||
| `wait` | bool | 否 | 是否等待索引刷新,默认 `true` |
|
||||
|
||||
覆盖修改:
|
||||
新增 memory 时传 `mode: "create"`。URI 应直接写到目标分类目录下,不要额外插入 `/user` 目录;例如偏好类 memory 使用 `viking://user/userA/memories/preferences/饮食偏好.md`。
|
||||
|
||||
```bash
|
||||
curl -sS -X POST "$API/memories" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"user_id": "userA",
|
||||
"user_key": "'"$USER_KEY"'",
|
||||
"uri": "viking://user/userA/memories/preferences/饮食偏好.md",
|
||||
"content": "用户喜欢喝茶",
|
||||
"mode": "create",
|
||||
"wait": true
|
||||
}'
|
||||
```
|
||||
|
||||
覆盖修改时把 `mode` 改为 `replace`:
|
||||
|
||||
```bash
|
||||
curl -sS -X POST "$API/memories" \
|
||||
@ -550,7 +565,7 @@ curl -sS -X POST "$API/memories" \
|
||||
}'
|
||||
```
|
||||
|
||||
追加补充时把 `mode` 改为 `append`;新增 memory 时可用默认的 `create`。
|
||||
追加补充时把 `mode` 改为 `append`。
|
||||
|
||||
### `DELETE /memories`
|
||||
|
||||
@ -654,8 +669,6 @@ curl -sS -X DELETE -G "$API/resources" \
|
||||
|
||||
同时查询 OpenViking 和 EverOS,并合并结果。
|
||||
|
||||
OpenViking memory 命中会额外用 `content/read` 补读最新正文,并在 item 中返回 `content`。这可以避免 OpenViking 搜索索引里的 `abstract` 暂时落后于刚刚 `replace` 的 memory 内容时误导调用方。
|
||||
|
||||
请求体:
|
||||
|
||||
| 参数 | 类型 | 必需 | 说明 |
|
||||
|
||||
Reference in New Issue
Block a user