mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 15:38:19 +08:00
refactor: unify agent audio capability access
This commit is contained in:
+2
-4
@@ -13,8 +13,8 @@
|
||||
"runtime_to_db": [],
|
||||
"workflow_to_db": []
|
||||
},
|
||||
"edge_count": 6549,
|
||||
"edge_sha256": "fb3c6b77623cc0ad1707fe8cdfc7e8a1c6be429a34da05b4fca5ed8ef512e734",
|
||||
"edge_count": 6547,
|
||||
"edge_sha256": "66726be779aae9069c32e8ccba1e7371eb99cfcc459666bc9805ddc25061ac63",
|
||||
"edges": [
|
||||
"app -> app.runtime",
|
||||
"app -> app.runtime.compat",
|
||||
@@ -1650,8 +1650,6 @@
|
||||
"app.api.endpoints.agent -> app.agent",
|
||||
"app.api.endpoints.agent -> app.agent.callback",
|
||||
"app.api.endpoints.agent -> app.agent.contracts",
|
||||
"app.api.endpoints.agent -> app.agent.llm",
|
||||
"app.api.endpoints.agent -> app.agent.llm.capability",
|
||||
"app.api.endpoints.agent -> app.agent.mcp",
|
||||
"app.api.endpoints.agent -> app.agent.runtime_loader",
|
||||
"app.api.endpoints.agent -> app.api",
|
||||
|
||||
@@ -1201,6 +1201,26 @@ def test_host_consumers_resolve_llm_provider_runtime_through_gateway():
|
||||
assert violations == {}
|
||||
|
||||
|
||||
def test_host_consumers_use_agent_audio_capability_application_port():
|
||||
"""宿主消费者不得绕过 Application 门面直连 Agent 音频实现。"""
|
||||
violations: dict[str, set[str]] = {}
|
||||
for module_name, path in _discover_modules().items():
|
||||
if module_name.startswith(("app.agent", "app.startup")):
|
||||
continue
|
||||
tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
|
||||
imported = {
|
||||
alias.name
|
||||
for node in ast.walk(tree)
|
||||
if isinstance(node, ast.ImportFrom)
|
||||
and node.module in {"app.agent.llm", "app.agent.llm.capability"}
|
||||
for alias in node.names
|
||||
if alias.name == "AgentCapabilityManager"
|
||||
}
|
||||
if imported:
|
||||
violations[module_name] = imported
|
||||
assert violations == {}
|
||||
|
||||
|
||||
def test_agent_tools_do_not_import_entrypoint_internals():
|
||||
"""Agent 工具不得穿透导入 HTTP 端点、调度器与命令注册表内部实现。
|
||||
|
||||
|
||||
@@ -942,10 +942,10 @@ def test_transcribe_web_agent_audio_files_reads_registered_upload(tmp_path):
|
||||
|
||||
try:
|
||||
with patch(
|
||||
"app.api.endpoints.agent.AgentCapabilityManager.is_audio_input_available",
|
||||
"app.api.endpoints.agent.is_audio_input_available",
|
||||
return_value=True,
|
||||
), patch(
|
||||
"app.api.endpoints.agent.AgentCapabilityManager.transcribe_audio",
|
||||
"app.api.endpoints.agent.transcribe_audio",
|
||||
return_value="帮我推荐一部电影",
|
||||
) as transcribe_audio:
|
||||
audio_files = _resolve_web_agent_audio_refs(
|
||||
|
||||
Reference in New Issue
Block a user