主动触发一次异步记忆整理任务。
POST /api/v1/forward/dreams
Dream 可以直接整理一个 Memory Store,也可以整理指定 Identity 与 Template 的 Default Memory。接口返回后任务在后台执行,调用方可通过详情或列表接口查询状态。
请求头
| Header | 是否必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer <PAT 或管理员 SAT>。 |
Content-Type | 是 | 固定为 application/json。 |
请求体参数
| 字段 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
inputs | object[] | 是 | — | 输入列表。必须包含且仅包含一个 memory_store 或 identity_template 主要输入,可以附加 sessions 输入。 |
model | string | 否 | auto | 模型档位:auto、lite 或 ultimate。 |
instructions | string | 否 | "" | 自定义整理指令,最长 4096 个字符。 |
inputs 元素
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
type | string | 是 | 输入类型:memory_store、identity_template 或 sessions。 |
memory_store_id | string | 条件必填 | type=memory_store 时必填;指定当前调用方可访问的 Memory Store。 |
identity_id | string | 条件必填 | type=identity_template 时必填。 |
template_id | string | 条件必填 | type=identity_template 时必填。 |
session_ids | string[] | 条件必填 | type=sessions 时必填且不能为空;所有 sessions 输入合计最多 100 个 Session ID。 |
identity_template 输入不能同时携带 memory_store_id。
两种主要输入的处理方式见 Dream input。
示例请求
整理 Identity 与 Template 的 Default Memory:
示例响应
HTTP 201 Created
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| 返回值 | object | 新创建的 Dream 对象。 |
错误
| HTTP | Type | 触发条件 |
|---|---|---|
400 | invalid_request_error | 请求体或输入组合不合法;error.code 可能为 invalid_dream_inputs、too_many_sessions、invalid_model 或 instructions_too_long。 |
401 | authentication_error | 认证信息缺失、无效或已过期。 |
403 | permission_error | 当前令牌不能管理 Dream;Identity SAT 不支持此接口。 |
404 | not_found_error | Memory Store 不存在或不可访问,或者指定的 Identity、Template、Default Memory 不存在;error.code 为 memory_store_not_found 或 dream_scope_not_found。 |
409 | invalid_request_error | 当前个人空间或 Workspace 已有 pending 或 running 状态的 Dream。 |
413 | invalid_request_error | 请求体超过大小限制。 |
429 | rate_limit_error | 请求频率或并发达到限制。 |
500/502/503 | api_error | 服务或内部依赖暂时不可用。 |

