fix(webui): hide subagent backfill payloads
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""Visibility helpers for persisted session history messages."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
from nanobot.session.automation_turns import is_automation_history_message
|
||||
|
||||
HIDDEN_HISTORY_META = "_hidden_history"
|
||||
|
||||
|
||||
def _has_hidden_history_marker(message: Mapping[str, Any] | None) -> bool:
|
||||
if not message:
|
||||
return False
|
||||
marker = message.get(HIDDEN_HISTORY_META)
|
||||
return marker is True or isinstance(marker, Mapping)
|
||||
|
||||
|
||||
def is_hidden_history_message(message: Mapping[str, Any] | None) -> bool:
|
||||
"""True for persisted messages that should not be shown as chat turns."""
|
||||
return _has_hidden_history_marker(message) or is_automation_history_message(message)
|
||||
@@ -31,8 +31,8 @@ from nanobot.bus.runtime_events import (
|
||||
TurnRunStatusChanged,
|
||||
)
|
||||
from nanobot.providers.base import LLMProvider
|
||||
from nanobot.session.automation_turns import is_automation_history_message
|
||||
from nanobot.session.goal_state import goal_state_ws_blob
|
||||
from nanobot.session.history_visibility import is_hidden_history_message
|
||||
from nanobot.session.manager import Session, SessionManager
|
||||
from nanobot.utils.helpers import strip_think, truncate_text
|
||||
from nanobot.utils.llm_runtime import LLMRuntime
|
||||
@@ -77,7 +77,7 @@ def _title_inputs(session: Session) -> tuple[str, str]:
|
||||
for message in session.messages:
|
||||
if message.get("_command") is True:
|
||||
continue
|
||||
if is_automation_history_message(message):
|
||||
if is_hidden_history_message(message):
|
||||
continue
|
||||
role = message.get("role")
|
||||
content = message.get("content")
|
||||
|
||||
Reference in New Issue
Block a user