From 6fd58073440c266e17766d4e55873d42997364f8 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 31 Aug 2026 03:50:13 +0200 Subject: [PATCH] refactor: name the terminal display helper after its setting The two helpers behind the backend terminal file display default used two different words for one thing: `is_terminal_file_display_inline` after the `terminalFileDisplay` setting, and `apply_display_file_inline_default` after the tool. The second also dropped the `terminal_` prefix every neighbour in this file carries (`build_terminal_file_tool_result`, `terminal_event_handler`), so it read as a generic helper despite only ever firing for `terminal:` tools. Renamed it to `apply_terminal_file_display_default` so both helpers speak the settings key's vocabulary and both carry the prefix. Identifier only, no behaviour change: substituting the old name back makes the file byte-identical to the previous commit, and ruff reports the same 62 diagnostics before and after. --- backend/open_webui/utils/middleware.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 28542de721..bbb22a75c2 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -311,7 +311,7 @@ async def is_terminal_file_display_inline(user: UserModel) -> bool: return value == 'inline' -async def apply_display_file_inline_default( +async def apply_terminal_file_display_default( tool_function_name: str, tool_function_params: dict, tool: dict | None, @@ -3204,7 +3204,7 @@ async def execute_tool_call_for_output(request, form_data, user, metadata, event direct_tool = tool.get('direct', False) allowed_params = spec.get('parameters', {}).get('properties', {}).keys() params = {key: value for key, value in params.items() if key in allowed_params} - params = await apply_display_file_inline_default(name, params, tool, user) + params = await apply_terminal_file_display_default(name, params, tool, user) try: if direct_tool: @@ -5665,7 +5665,7 @@ async def streaming_chat_response_handler(response, ctx): direct_tool = tool.get('direct', False) allowed_params = spec.get('parameters', {}).get('properties', {}).keys() params = {key: value for key, value in params.items() if key in allowed_params} - params = await apply_display_file_inline_default(name, params, tool, user) + params = await apply_terminal_file_display_default(name, params, tool, user) try: if direct_tool: result = await event_caller(