fix: restore heaven interpretation persistence dependency
This commit is contained in:
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
import secrets
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
|||||||
@@ -354,8 +354,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "backend/features/heaven/service.py",
|
"path": "backend/features/heaven/service.py",
|
||||||
"bytes": 63123,
|
"bytes": 63138,
|
||||||
"lines": 1303
|
"lines": 1304
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "backend/features/market/insights.py",
|
"path": "backend/features/market/insights.py",
|
||||||
|
|||||||
@@ -124,6 +124,50 @@ class HeavenReadingTests(unittest.TestCase):
|
|||||||
len(self.database.list_heaven_readings(self.owner["id"], "fortune")), 1
|
len(self.database.list_heaven_readings(self.owner["id"], "fortune")), 1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_trend_interpretation_saves_successful_agent_result(self):
|
||||||
|
service = DashboardService.__new__(DashboardService)
|
||||||
|
service.database = self.database
|
||||||
|
service._request_context = threading.local()
|
||||||
|
service._request_context.user_id = self.owner["id"]
|
||||||
|
setup = {
|
||||||
|
"trade_date": "20260723",
|
||||||
|
"chart": {
|
||||||
|
"available": True,
|
||||||
|
"sector": "银行",
|
||||||
|
"stock": {"code": "000001", "name": "平安银行"},
|
||||||
|
"hexagram": {
|
||||||
|
"name": "中孚",
|
||||||
|
"lines": [],
|
||||||
|
"transformed": {"name": "小畜"},
|
||||||
|
},
|
||||||
|
"movement": {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
with patch.object(service, "heaven_setup", return_value=setup), patch.object(
|
||||||
|
service,
|
||||||
|
"_call_heaven_agent",
|
||||||
|
return_value=(
|
||||||
|
{"answer": "完整的解势结果", "model": "test", "latency_ms": 1},
|
||||||
|
"primary",
|
||||||
|
),
|
||||||
|
):
|
||||||
|
result = service.heaven_interpret(
|
||||||
|
{
|
||||||
|
"mode": "trend",
|
||||||
|
"trade_date": "2026-07-23",
|
||||||
|
"stock_code": "000001",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertFalse(result["reused"])
|
||||||
|
self.assertEqual(result["answer"], "完整的解势结果")
|
||||||
|
self.assertEqual(result["reading"]["subject"], "000001 平安银行")
|
||||||
|
self.assertEqual(
|
||||||
|
self.database.list_heaven_readings(self.owner["id"], "trend")[0]["answer"],
|
||||||
|
"完整的解势结果",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -284,9 +284,15 @@
|
|||||||
`MiniMax-M2.7-highspeed`在2236毫秒内回复`OK`,证明服务进程的数据与LLM出网链路均已恢复。
|
`MiniMax-M2.7-highspeed`在2236毫秒内回复`OK`,证明服务进程的数据与LLM出网链路均已恢复。
|
||||||
- 修正后候选329项、纯`app/`导出266项通过;本次只恢复缺失导入和测试,不修改模型配置、额度、
|
- 修正后候选329项、纯`app/`导出266项通过;本次只恢复缺失导入和测试,不修改模型配置、额度、
|
||||||
提示词、回退策略、行情来源或计算逻辑。
|
提示词、回退策略、行情来源或计算逻辑。
|
||||||
|
- 继续验收观势时发现模型已经成功返回,但问天服务在保存解势记录前关闭了HTTP连接。原因是原版
|
||||||
|
`server.py`已有的`secrets`导入在机械拆分到问天服务时遗漏,生成非观气记录去重键时触发
|
||||||
|
`NameError`。迁移版恢复该标准库依赖,并增加“模型成功返回后保存观势结果”的完整服务回归测试。
|
||||||
|
- 使用`000001 平安银行`完成真实页面复测:六爻安全门6/6通过,解势结果正常返回并写入历史,
|
||||||
|
`8797`错误日志为空。该修正不改变提示词、模型选择、额度、卦象计算、记录结构或前端行为。
|
||||||
|
|
||||||
本修正基线为`xiaobai-reduction-11-background-jobs-20260801`;检查点为
|
本修正基线为`xiaobai-reduction-11-background-jobs-20260801`;检查点为
|
||||||
`xiaobai-reduction-11-runtime-connectivity-fix-20260802`。
|
`xiaobai-reduction-11-runtime-connectivity-fix-20260802`;后续解势修正检查点为
|
||||||
|
`xiaobai-reduction-11-heaven-interpret-fix-20260802`。
|
||||||
|
|
||||||
## 人工验收记录
|
## 人工验收记录
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user