sync: 鍚屾灞€鍩熺綉鏈€鏂颁唬鐮?(source master @ b69568e4)
This commit is contained in:
1 parent
4f7f07504a
commit
8bc8b0e082
1651 files changed
+278599
-11416
No files matched your search
@@ -91,7 +91,7 @@ def _patch(monkeypatch, intranet_url="http://es/api", intranet_cls=_FakeIntranet
|
||||
|
||||
monkeypatch.setattr(R, "_stream_llm_json", fake_stream_llm_json)
|
||||
# knowledge_base 模式不该加载/编排技能,但仍打桩以防意外路径
|
||||
monkeypatch.setattr(R, "_load_configured_skills",
|
||||
monkeypatch.setattr(R, "_load_candidate_skills",
|
||||
lambda: [SimpleNamespace(name="knowledge-search-v2", description="内网检索")])
|
||||
monkeypatch.setattr(R, "get_search_provider", lambda _cfg: _SkillProviderShouldNotRun())
|
||||
monkeypatch.setattr(
|
||||
@@ -110,6 +110,50 @@ def _state(material_source="knowledge_base"):
|
||||
}
|
||||
|
||||
|
||||
def test_general_skill_candidates_do_not_resurrect_explicitly_offline_knowledge_search(
|
||||
tmp_path,
|
||||
monkeypatch,
|
||||
) -> None:
|
||||
extensions_path = tmp_path / "extensions_config.json"
|
||||
extensions_path.write_text(
|
||||
'{"mcpServers": {}, "skills": {"knowledge-base-search": {"enabled": false}}}',
|
||||
encoding="utf-8",
|
||||
)
|
||||
monkeypatch.setenv("DEER_FLOW_EXTENSIONS_CONFIG_PATH", str(extensions_path))
|
||||
|
||||
other = SimpleNamespace(name="other-search", description="other")
|
||||
|
||||
class _Storage:
|
||||
def load_skills(self, *, enabled_only=False):
|
||||
assert enabled_only is True
|
||||
return [other]
|
||||
|
||||
import deerflow.skills.storage as storage_module
|
||||
|
||||
monkeypatch.setattr(storage_module, "get_or_new_skill_storage", lambda: _Storage())
|
||||
|
||||
assert [skill.name for skill in R._load_candidate_skills()] == ["other-search"]
|
||||
assert [skill.name for skill in R._fallback_candidate_skills(set())] == ["other-search"]
|
||||
|
||||
|
||||
def test_general_skill_candidates_keep_missing_catalog_fallback(tmp_path, monkeypatch) -> None:
|
||||
extensions_path = tmp_path / "extensions_config.json"
|
||||
extensions_path.write_text('{"mcpServers": {}, "skills": {}}', encoding="utf-8")
|
||||
monkeypatch.setenv("DEER_FLOW_EXTENSIONS_CONFIG_PATH", str(extensions_path))
|
||||
|
||||
class _Storage:
|
||||
def load_skills(self, *, enabled_only=False):
|
||||
assert enabled_only is True
|
||||
return []
|
||||
|
||||
import deerflow.skills.storage as storage_module
|
||||
|
||||
monkeypatch.setattr(storage_module, "get_or_new_skill_storage", lambda: _Storage())
|
||||
|
||||
assert [skill.name for skill in R._load_candidate_skills()] == [R.KNOWLEDGE_SEARCH_SKILL_NAME]
|
||||
assert [skill.name for skill in R._fallback_candidate_skills(set())] == [R.KNOWLEDGE_SEARCH_SKILL_NAME]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_knowledge_base_hits_intranet_directly(monkeypatch):
|
||||
_patch(monkeypatch)
|
||||
|
||||
Reference in new issue
Block a user