e80a82bef4
- 更新 http-error-codes, user-points-chat-data-protocol - 更新 divination-run-protocol, profile-protocol - 删除废弃的后端和前端设计计划文档
30 lines
875 B
Python
30 lines
875 B
Python
from __future__ import annotations
|
|
|
|
from v1.agent.schemas import HistoryMessage
|
|
|
|
|
|
def test_history_message_accepts_follow_up_error_payload() -> None:
|
|
payload = {
|
|
"id": "msg-1",
|
|
"threadId": "thread-1",
|
|
"seq": 2,
|
|
"role": "assistant",
|
|
"content": "补充回答",
|
|
"timestamp": "2026-04-08T07:31:24+00:00",
|
|
"agent_output": {
|
|
"status": "failed",
|
|
"answer": "需要补充信息",
|
|
"error": {
|
|
"code": "INVALID_INPUT",
|
|
"message": "输入内容不完整",
|
|
"retryable": True,
|
|
"details": {},
|
|
},
|
|
},
|
|
}
|
|
|
|
parsed = HistoryMessage.model_validate(payload)
|
|
assert parsed.agent_output is not None
|
|
assert parsed.agent_output.error is not None
|
|
assert parsed.agent_output.error.code == "INVALID_INPUT"
|