mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-07 08:27:05 +00:00
refac
This commit is contained in:
parent
4567cdc0d9
commit
52a06bd48a
2 changed files with 7 additions and 2 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue