36 lines
998 B
Markdown
36 lines
998 B
Markdown
# Agent 会话数据库设计
|
|
|
|
## 1. 表结构
|
|
|
|
| 表 | 说明 |
|
|
|----|------|
|
|
| `agent_definition` | Agent 定义 |
|
|
| `agent_session` | Agent 会话 |
|
|
| `agent_message` | Agent 消息 |
|
|
| `agent_capability_binding` | 能力绑定 |
|
|
|
|
## 2. 关键约束
|
|
|
|
- `agent_definition.agent_code` 唯一。
|
|
- `agent_session.session_code` 唯一。
|
|
- `agent_session.agent_id` 引用 `agent_definition`。
|
|
- `agent_session.workflow_run_id` 可引用 `workflow_run`。
|
|
- `agent_message.session_id` 引用 `agent_session`。
|
|
- `agent_capability_binding` 使用 `(owner_type, owner_id, capability_type, capability_id)` 唯一。
|
|
|
|
## 3. JSON 字段
|
|
|
|
- `agent_session.metadata_json` 保存会话扩展信息。
|
|
- `agent_message.citation_json` 保存引用切片摘要。
|
|
- `agent_capability_binding.config_json` 保存能力绑定配置。
|
|
|
|
## 4. 脚本
|
|
|
|
- `script/sql/8.agent_definition.sql`
|
|
- `script/sql/13.agent_session.sql`
|
|
- `script/sql/16.agent_capability_binding.sql`
|
|
- `docs/STUDIO_PROTOTYPE_SCHEMA.sql`
|
|
|
|
|
|
|