This commit is contained in:
Timothy Jaeryang Baek
2026-03-26 18:22:14 -05:00
parent 4567cdc0d9
commit 52a06bd48a
2 changed files with 7 additions and 2 deletions

View File

@@ -2607,12 +2607,17 @@ async def process_chat_payload(request, form_data, user, metadata, model):
# so system terminals work even when no other tools are selected)
if terminal_id:
try:
terminal_tools, system_prompt = await get_terminal_tools(
terminal_result = await get_terminal_tools(
request,
terminal_id,
user,
extra_params,
)
if isinstance(terminal_result, tuple):
terminal_tools, system_prompt = terminal_result
else:
terminal_tools = terminal_result
system_prompt = None
if terminal_tools:
tools_dict = {**tools_dict, **terminal_tools}
if system_prompt:

View File

@@ -956,7 +956,7 @@ async def get_terminal_tools(
terminal_id: str,
user: UserModel,
extra_params: dict,
) -> tuple[dict[str, dict], Optional[str]]:
) -> dict[str, dict] | tuple[dict[str, dict], Optional[str]]:
"""Resolve tools for a terminal server identified by terminal_id.
- Finds the connection in TERMINAL_SERVER_CONNECTIONS