refactor: 重构 schemas 结构,统一枚举定义

This commit is contained in:
qzl
2026-03-25 12:36:31 +08:00
parent 389f5248fc
commit d22ded21f8
122 changed files with 774 additions and 1456 deletions
+1
View File
@@ -10,6 +10,7 @@ scheduler computation, and Flutter settings pages.
- `id`: UUID
- `owner_id`: UUID
- `title`: string
- `bootstrap_key`: string | null (引导配置键,用于标识预设任务模板)
- `config`: object
- `input_template`: string
- `enabled_tools`: string[]
+2
View File
@@ -49,6 +49,8 @@ Base URL: `/api/v1/friends`
}
```
说明:`status` 对外返回的值包括 `pending`、`accepted`、`rejected`、`canceled`。内部实现中还有 `blocked` 和 `declined` 状态,在返回给客户端时会映射为 `rejected` 或 `canceled`。
### FriendResponse
```json
+1
View File
@@ -92,6 +92,7 @@ Base URL: `/api/v1/inbox/messages`
"message_type": "InboxMessageType",
"schedule_item_id": "uuid | null",
"friendship_id": "uuid | null",
"group_id": "uuid | null",
"content": "CalendarInviteContent | CalendarUpdateContent | CalendarDeleteContent | FriendshipContent | null",
"is_read": "boolean",
"status": "InboxMessageStatus",
+4 -3
View File
@@ -172,7 +172,6 @@
|------|------|------|
| `id` | UUID | 主键 |
| `owner_id` | UUID | 所有者用户 ID |
| `agent_id` | UUID | 关联 Agent ID(可选) |
| `memory_type` | VARCHAR(20) | 记忆类型枚举(当前含 `user``work`,可扩展) |
| `content` | JSONB | UserMemoryContent 或 WorkProfileContent |
| `status` | VARCHAR(20) | ACTIVE / DISABLED |
@@ -181,6 +180,7 @@
说明:
- `source` 列已移除,不再作为行级来源标记。
- `agent_id` 列不存在。
- 来源信息如果需要保留,使用 `content` 内各条目的 `meta.source`(字段级来源)。
- 唯一性约束:同一 `owner_id``memory_type` 不能重复(`UNIQUE(owner_id, memory_type)`)。
@@ -306,8 +306,9 @@ build_system_prompt(
| 文件 | 职责 |
|------|------|
| `src/schemas/memories/memory_content.py` | UserMemoryContent、WorkProfileContent 模型 |
| `src/schemas/memories/__init__.py` | MemoryType、MemoryStatus 枚举 |
| `src/schemas/domain/memory_content.py` | UserMemoryContent、WorkProfileContent 模型 |
| `src/schemas/domain/memory.py` | MemoryModel 聚合模型 |
| `src/schemas/enums.py` | MemoryType、MemoryStatus 枚举 |
| `src/models/memories.py` | SQLAlchemy ORM 模型 |
| `src/v1/memories/router.py` | API 端点 |
| `src/v1/memories/service.py` | 业务逻辑层 |