Files
fquiz/memory/2026-06-16.md
T
chengkai3 946312cb6e fix:[FL-143][处理消息查看报错]
Co-authored-by: multica-agent <github@multica.ai>
2026-06-16 17:03:18 +08:00

17 lines
906 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Work Log - 修复系统消息查看 5002026-06-16
- 背景:
- `/api/v1/system-messages/me` 返回系统消息列表时,对 SQLAlchemy ORM 对象执行 `SystemMessagePublic.model_validate()`Pydantic v2 未启用属性读取,导致 500。
- 本次处理:
-`SystemMessagePublic` 增加 `ConfigDict(from_attributes=True)`,允许响应 schema 从 ORM/属性对象读取字段。
- 新增系统消息 schema 回归测试,覆盖属性对象序列化路径。
- 验证:
- 基线:未启用 `from_attributes` 时,属性对象 `model_validate` 复现 Pydantic `model_type` 校验失败。
- 修改后:属性对象 `model_validate` 可正常输出。
- `pytest api/tests/test_system_message_schema.py` 通过。
- 风险与关注点:
- 改动仅影响系统消息公开响应 schema 的序列化方式,不改变接口字段、数据库结构或查询逻辑。