This commit is contained in:
@@ -9,6 +9,7 @@ import test_project_assistant as fixtures
|
||||
from services.assistant_store import get, put, listing
|
||||
from services.component_registry import draft, release, ordered, normalize
|
||||
from services.component_evaluation import evaluate
|
||||
from services.assistant_model import ModelResult, configuration
|
||||
|
||||
|
||||
class StructuredToolModel(BaseChatModel):
|
||||
@@ -44,6 +45,25 @@ class StructuredToolModel(BaseChatModel):
|
||||
|
||||
class ComponentTests(fixtures.ProjectAssistantTests):
|
||||
# Reuse only the fixture helpers, not inherited test execution (filtered below).
|
||||
def test_model_endpoint_policy_allows_only_private_or_official_deepseek(self):
|
||||
with patch.dict("os.environ", {"XINGBANG_LOCAL_MODEL_URL": "https://api.deepseek.com", "XINGBANG_LOCAL_MODEL_NAME": "deepseek-chat"}):
|
||||
config = configuration()
|
||||
self.assertTrue(config["available"])
|
||||
self.assertEqual(config["name"], "deepseek-chat")
|
||||
with patch.dict("os.environ", {"XINGBANG_LOCAL_MODEL_URL": "http://api.deepseek.com"}):
|
||||
with self.assertRaises(ValueError):
|
||||
configuration()
|
||||
|
||||
def test_requirement_response_object_is_normalized_to_readable_text(self):
|
||||
result = ModelResult.model_validate({
|
||||
"findings": [],
|
||||
"requirement_response": {"数据读取": "完成", "待核实": "现金流缺失"},
|
||||
})
|
||||
self.assertEqual(result.requirement_response, "数据读取:完成;待核实:现金流缺失")
|
||||
with patch.dict("os.environ", {"XINGBANG_LOCAL_MODEL_URL": "https://example.com/v1"}):
|
||||
with self.assertRaises(ValueError):
|
||||
configuration()
|
||||
|
||||
def test_real_agent_manager_and_invalid_evidence(self):
|
||||
with patch.dict("os.environ", {"XINGBANG_LOCAL_MODEL_URL": "http://127.0.0.1:11434/v1"}), patch("services.assistant_model.ChatOpenAI", return_value=StructuredToolModel()):
|
||||
a = self.run_project("DEMO-A", "跳过现金流检查")
|
||||
|
||||
Reference in New Issue
Block a user