docs: 更新协议文档,删除废弃计划文档

- 更新 http-error-codes, user-points-chat-data-protocol
- 更新 divination-run-protocol, profile-protocol
- 删除废弃的后端和前端设计计划文档
This commit is contained in:
qzl
2026-04-08 17:23:02 +08:00
parent 49fc9a116f
commit e80a82bef4
57 changed files with 4117 additions and 2269 deletions
@@ -0,0 +1,29 @@
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"
@@ -3,7 +3,11 @@ from __future__ import annotations
import pytest
from pydantic import ValidationError
from schemas.agent.runtime_models import WorkerAgentOutputLite
from schemas.agent.runtime_models import (
FollowUpOutput,
WorkerAgentOutputLite,
resolve_worker_output_model,
)
def test_worker_output_lite_rejects_divination_derived_from_llm() -> None:
@@ -20,3 +24,29 @@ def test_worker_output_lite_rejects_divination_derived_from_llm() -> None:
with pytest.raises(ValidationError):
WorkerAgentOutputLite.model_validate(payload)
def test_follow_up_output_accepts_minimal_schema() -> None:
payload = {
"status": "success",
"answer": "追问回答",
}
parsed = FollowUpOutput.model_validate(payload)
assert parsed.answer == "追问回答"
def test_follow_up_output_rejects_chat_only_fields() -> None:
payload = {
"status": "success",
"answer": "追问回答",
"sign_level": "中上签",
}
with pytest.raises(ValidationError):
FollowUpOutput.model_validate(payload)
def test_resolve_worker_output_model_uses_runtime_mode() -> None:
assert resolve_worker_output_model(runtime_mode="chat") is WorkerAgentOutputLite
assert resolve_worker_output_model(runtime_mode="follow_up") is FollowUpOutput