refactor(agent): compose image tools in application runtimes (#6172)

* refactor(agent): move image configuration ownership into tools

* refactor(agent): compose image tools in application runtimes
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-12 17:42:45 +08:00
1 parent e148296d5c
commit 105b772203
22 files changed
+269 -236

No files matched your search

+17
View File
@@ -118,6 +118,23 @@ def test_from_config_composes_configured_mcp_outside_agent_loop(tmp_path):
assert bot._mcp_provider._registry is bot._loop.tools
def test_from_config_uses_instance_image_settings(tmp_path, monkeypatch):
from nanobot.agent.tools.image_generation import ImageGenerationTool
monkeypatch.setattr("nanobot.config.loader._current_config_path", tmp_path / "default.json")
config_path = _write_config(
tmp_path,
{"tools": {"imageGeneration": {"enabled": True, "model": "instance-image-model"}}},
)
bot = Nanobot.from_config(config_path, workspace=tmp_path)
tool = bot._loop.tools.get("generate_image")
assert isinstance(tool, ImageGenerationTool)
assert tool.config.model == "instance-image-model"
assert tool.provider_configs["openrouter"].api_key == "sk-test-key"
def test_from_config_accepts_default_model_override(tmp_path):
config_path = _write_config(tmp_path)