Add special handling for 'process' tool in _build_tool_preview function

- Enhanced the _build_tool_preview function to include specific formatting for the 'process' tool, displaying action, session_id, data, and timeout when applicable.
- This update improves the clarity of tool previews, particularly for actions that require session tracking and timeout management.
This commit is contained in:
teknium1 2026-02-17 03:18:27 -08:00
parent ec59d71e60
commit 6731230d73

View file

@ -850,6 +850,21 @@ def _build_tool_preview(tool_name: str, args: dict, max_len: int = 40) -> str:
"schedule_cronjob": "name",
}
# Special handling for the process tool -- show action + session_id
if tool_name == "process":
action = args.get("action", "")
session_id = args.get("session_id", "")
data = args.get("data", "")
timeout = args.get("timeout")
parts = [action]
if session_id:
parts.append(session_id[:16])
if data:
parts.append(f'"{data[:20]}"')
if timeout and action == "wait":
parts.append(f"{timeout}s")
return " ".join(parts) if parts else None
key = primary_args.get(tool_name)
if not key:
# Try common arg names as fallback