refactor(agent): remove legacy image mode prompt injection

This commit is contained in:
chengyongru
2026-07-12 00:35:17 +08:00
committed by Xubin Ren
parent 2eb7398f34
commit e206ee4e70
10 changed files with 1 additions and 198 deletions
-15
View File
@@ -8,7 +8,6 @@ from typing import TYPE_CHECKING, Any
from pydantic import Field
from nanobot.agent.tools.base import Tool, ToolResult, tool_parameters
from nanobot.agent.tools.context import RequestContext
from nanobot.agent.tools.schema import (
ArraySchema,
IntegerSchema,
@@ -22,7 +21,6 @@ from nanobot.providers.image_generation import (
ImageGenerationProvider,
get_image_gen_provider,
)
from nanobot.runtime_context import RuntimeContextBlock
from nanobot.security.workspace_access import current_tool_workspace
from nanobot.security.workspace_policy import WorkspaceBoundaryError, resolve_allowed_path
from nanobot.utils.artifacts import (
@@ -31,7 +29,6 @@ from nanobot.utils.artifacts import (
store_generated_image_artifact,
)
from nanobot.utils.helpers import detect_image_mime
from nanobot.utils.image_generation_intent import image_generation_runtime_context
if TYPE_CHECKING:
from nanobot.config.schema import ProviderConfig
@@ -119,18 +116,6 @@ class ImageGenerationTool(Tool):
"or user image paths as reference_images."
)
def runtime_context_provider(self):
return self._provide_runtime_context
async def _provide_runtime_context(
self,
request: RequestContext,
) -> RuntimeContextBlock | None:
content = image_generation_runtime_context(request.metadata)
if not content:
return None
return RuntimeContextBlock(source="image_generation", content=content)
def _provider_config(self) -> ProviderConfig | None:
return self.provider_configs.get(self.config.provider)