Refactor media payload handling to persist base64 blobs as attachment refs and keep non-turn model paths safe by degrading risky payloads.

This preserves multimodal fidelity for the latest user turn while preventing historical/tool replay bloat, and adds admin UI support for referenced attachment preview/download flows.

Made-with: Cursor
This commit is contained in:
oliver 2026-04-28 10:30:27 +08:00
parent 3d27a01879
commit 6cfaff06f6
20 changed files with 1626 additions and 101 deletions

View file

@ -8,6 +8,7 @@ from typing import Any
from oclaw.runtime.types import StandardMessage
from oclaw.runtime.types import normalize_interaction_mode, normalize_requested_specialist
from oclaw.prompts.loader import render_runtime_prompt
from oclaw.runtime.chat.model_path_audit import ensure_no_tool_or_embedded_image_payload
@dataclass(frozen=True)
@ -86,6 +87,7 @@ def _decide_llm_json(msg: StandardMessage, *, model: Any | None) -> RouterDecisi
},
{"role": "user", "content": user_block},
]
ensure_no_tool_or_embedded_image_payload(messages=messages, path="router.llm_json")
resp = model.chat(messages, [], on_token=None)
raw = str(getattr(resp, "content", "") or "")
obj = _parse_router_json_object(raw)