refac
This commit is contained in:
@@ -27,6 +27,7 @@ from open_webui.utils.terminals import (
|
||||
terminal_context_available,
|
||||
terminal_context_config,
|
||||
terminal_context_id,
|
||||
terminal_chat_uploads,
|
||||
terminal_contexts,
|
||||
)
|
||||
from open_webui.utils.tools import bearer_auth_header, normalize_bearer_token
|
||||
@@ -87,6 +88,7 @@ async def list_terminal_servers(request: Request, user=Depends(get_verified_user
|
||||
'url': connection.get('url', ''),
|
||||
'name': connection.get('name', ''),
|
||||
'contexts': terminal_contexts(connection),
|
||||
'config': {'chat_uploads': terminal_chat_uploads(connection)},
|
||||
}
|
||||
for connection in connections
|
||||
if connection.get('enabled', True) and await has_connection_access(user, connection, user_group_ids)
|
||||
|
||||
@@ -8,6 +8,7 @@ TERMINAL_CONTEXT_HEADER = 'X-Terminal-Context-Id'
|
||||
TERMINAL_CONTEXT_DEFAULT = 'default'
|
||||
TERMINAL_CONTEXT_TYPES = {'chat', 'automation'}
|
||||
TERMINAL_CONTEXT_ID_SOURCES = {'chat': 'chat_id', 'automation': 'automation_id'}
|
||||
TERMINAL_CHAT_UPLOAD_MODES = {'default', 'filesystem'}
|
||||
|
||||
|
||||
def is_terminal_orchestrator(connection: dict) -> bool:
|
||||
@@ -104,3 +105,9 @@ def terminal_contexts(connection: dict) -> dict:
|
||||
else:
|
||||
result[context] = {}
|
||||
return result
|
||||
|
||||
|
||||
def terminal_chat_uploads(connection: dict) -> str:
|
||||
"""Return normalized main-chat upload behavior for this connection."""
|
||||
value = (connection.get('config') or {}).get('chat_uploads')
|
||||
return value if value in TERMINAL_CHAT_UPLOAD_MODES else 'default'
|
||||
|
||||
Reference in New Issue
Block a user