feat: 重构 agentscope 缓存架构,新增消息和附件缓存
This commit is contained in:
@@ -364,7 +364,8 @@ cost = uncached_prompt_tokens * input_cost_per_token
|
||||
| 0 | `UI_HISTORY` | `/history` API 投影可见的消息 |
|
||||
| 1 | `CONTEXT_ASSEMBLY` | 运行时上下文装配(context assembly)可见 |
|
||||
|
||||
> 新消息入库时,`chat` 模式设置 `mask = UI_HISTORY | CONTEXT_ASSEMBLY`(值为 3),`automation` 模式设置 `mask = 0`。
|
||||
> 用户输入入库时,`chat` 模式设置 `mask = UI_HISTORY | CONTEXT_ASSEMBLY`(值为 3),`automation` 模式设置 `mask = 0`。
|
||||
> agent 运行产物入库时,`automation` 模式设置 `mask = UI_HISTORY`(值为 1),用于展示历史但不参与 context assembly。
|
||||
|
||||
### /history API
|
||||
|
||||
@@ -385,6 +386,7 @@ WHERE (visibility_mask & 2) != 0
|
||||
**影响**:
|
||||
- `chat` 模式用户输入:mask=3 → 进入 `/history` ✅,进入 context assembly ✅
|
||||
- `automation` 模式用户输入:mask=0 → 进入 `/history` ❌,进入 context assembly ❌
|
||||
- `automation` 模式 agent 输出:mask=1 → 进入 `/history` ✅,进入 context assembly ❌
|
||||
|
||||
### Automation 模式上下文注入
|
||||
|
||||
@@ -396,7 +398,8 @@ WHERE (visibility_mask & 2) != 0
|
||||
|------|--------|--------------|
|
||||
| Pipeline | `router` -> `worker` | `router` -> `worker` |
|
||||
| 用户输入 visibility_mask | `UI_HISTORY \| CONTEXT_ASSEMBLY` | `0` |
|
||||
| 进入 /history | ✅ | ❌ |
|
||||
| agent 输出 visibility_mask | `UI_HISTORY \| CONTEXT_ASSEMBLY`(memory stage 仅 `UI_HISTORY`) | `UI_HISTORY` |
|
||||
| 进入 /history | ✅ | ✅(仅 agent 输出) |
|
||||
| 进入 context assembly | ✅(自动) | ❌(通过 run_input 注入) |
|
||||
| enabled_tools 来源 | `system_agents.yaml` worker 配置 | `AutomationJob.config.enabled_tools` |
|
||||
| context 配置来源 | `system_agents.yaml` router context_messages | `AutomationJob.config.context` |
|
||||
|
||||
Reference in New Issue
Block a user