fix: restore llm model validation dependency
This commit is contained in:
@@ -4,6 +4,7 @@ from datetime import datetime, timezone
|
||||
from typing import Any
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from backend.bootstrap.config import validate_text
|
||||
from backend.features.screener.compiler import LLMCompilerError, test_llm_connection
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from backend.llm import LLMGateway, LLMGatewayError
|
||||
from backend.llm.service import LLMServiceMixin
|
||||
|
||||
|
||||
class ProviderFailure(RuntimeError):
|
||||
@@ -113,6 +115,31 @@ class LLMGatewayTests(unittest.TestCase):
|
||||
with self.assertRaisesRegex(LLMGatewayError, "额度已用完"):
|
||||
gateway.call("mentor", "mentor-v1", lambda model: "unused", (ProviderFailure,))
|
||||
|
||||
def test_saved_system_model_can_reach_the_connection_probe(self) -> None:
|
||||
service = LLMServiceMixin()
|
||||
service._system_credentials = {
|
||||
"llm_models": [
|
||||
{
|
||||
"id": "primary-model",
|
||||
"name": "主模型",
|
||||
"api_key": "secret",
|
||||
"base_url": "https://model.example/v1",
|
||||
"model": "model-name",
|
||||
}
|
||||
]
|
||||
}
|
||||
service.llm_gateway = self.gateway()
|
||||
expected = {"ok": True, "reply": "OK"}
|
||||
with patch(
|
||||
"backend.llm.service.test_llm_connection", return_value=expected
|
||||
) as connection_probe:
|
||||
result = service.test_system_llm_profile("primary-model", {})
|
||||
|
||||
self.assertEqual(result, expected)
|
||||
connection_probe.assert_called_once_with(
|
||||
"secret", "https://model.example/v1", "model-name"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -274,6 +274,20 @@
|
||||
本批基线为`xiaobai-reduction-10-repository-ownership-20260801`;检查点为
|
||||
`xiaobai-reduction-11-background-jobs-20260801`。
|
||||
|
||||
## CR-11人工验收修正
|
||||
|
||||
- 2026-08-02人工验收发现本地页面可访问,但行情与LLM同时无法连接。第一原因是验收服务由受限
|
||||
自动化会话启动,子进程继承了禁止外部网络访问的权限;重新在主机正常网络权限下启动后恢复。
|
||||
- 随后的主模型连接测试暴露`LLMServiceMixin`机械迁移时遗漏`validate_text`导入,导致请求在真正
|
||||
访问模型前抛出`NameError`并关闭HTTP连接;恢复原依赖并增加保存模型连接探测的运行契约测试。
|
||||
- 网站自身实测`000001`返回Tushare日K 60根、分时242点;主模型
|
||||
`MiniMax-M2.7-highspeed`在2236毫秒内回复`OK`,证明服务进程的数据与LLM出网链路均已恢复。
|
||||
- 修正后候选329项、纯`app/`导出266项通过;本次只恢复缺失导入和测试,不修改模型配置、额度、
|
||||
提示词、回退策略、行情来源或计算逻辑。
|
||||
|
||||
本修正基线为`xiaobai-reduction-11-background-jobs-20260801`;检查点为
|
||||
`xiaobai-reduction-11-runtime-connectivity-fix-20260802`。
|
||||
|
||||
## 人工验收记录
|
||||
|
||||
- 2026-08-01:用户检查CR-02与CR-03运行结果,确认未发现明显异常。本记录仅表示本轮可见功能与
|
||||
|
||||
Reference in New Issue
Block a user