refac
This commit is contained in:
@@ -272,6 +272,7 @@ async def _set_terminal_cwd(app, server_id: str, user, cwd: str, chat_id: str) -
|
||||
handled correctly — same path the frontend uses.
|
||||
"""
|
||||
import aiohttp
|
||||
from open_webui.env import AIOHTTP_CLIENT_SESSION_SSL
|
||||
|
||||
connections = getattr(getattr(app, 'state', None), 'config', None)
|
||||
if connections is None:
|
||||
@@ -307,6 +308,7 @@ async def _set_terminal_cwd(app, server_id: str, user, cwd: str, chat_id: str) -
|
||||
target_url,
|
||||
json={'path': cwd},
|
||||
headers=headers,
|
||||
ssl=AIOHTTP_CLIENT_SESSION_SSL,
|
||||
) as resp:
|
||||
if resp.status != 200:
|
||||
body = await resp.text()
|
||||
|
||||
@@ -44,6 +44,7 @@ from open_webui.utils.plugin import load_tool_module_by_id
|
||||
from open_webui.utils.access_control import has_access, has_connection_access
|
||||
from open_webui.config import BYPASS_ADMIN_ACCESS_CONTROL
|
||||
from open_webui.env import (
|
||||
AIOHTTP_CLIENT_SESSION_SSL,
|
||||
AIOHTTP_CLIENT_TIMEOUT,
|
||||
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER,
|
||||
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA,
|
||||
@@ -907,7 +908,7 @@ async def get_terminal_cwd(
|
||||
timeout=aiohttp.ClientTimeout(total=5),
|
||||
trust_env=True,
|
||||
) as session:
|
||||
async with session.get(cwd_url, headers=headers, cookies=cookies or {}) as resp:
|
||||
async with session.get(cwd_url, headers=headers, cookies=cookies or {}, ssl=AIOHTTP_CLIENT_SESSION_SSL) as resp:
|
||||
if resp.status == 200:
|
||||
data = await resp.json()
|
||||
return data.get('cwd')
|
||||
@@ -934,7 +935,7 @@ async def get_terminal_system_prompt(
|
||||
trust_env=True,
|
||||
) as session:
|
||||
# 1. Check feature flag
|
||||
async with session.get(f'{base}/api/config') as resp:
|
||||
async with session.get(f'{base}/api/config', ssl=AIOHTTP_CLIENT_SESSION_SSL) as resp:
|
||||
if resp.status != 200:
|
||||
return None
|
||||
config = await resp.json()
|
||||
@@ -942,7 +943,7 @@ async def get_terminal_system_prompt(
|
||||
return None
|
||||
|
||||
# 2. Fetch system prompt
|
||||
async with session.get(f'{base}/system', headers=headers, cookies=cookies or {}) as resp:
|
||||
async with session.get(f'{base}/system', headers=headers, cookies=cookies or {}, ssl=AIOHTTP_CLIENT_SESSION_SSL) as resp:
|
||||
if resp.status == 200:
|
||||
data = await resp.json()
|
||||
return data.get('prompt')
|
||||
|
||||
@@ -3,7 +3,7 @@ import logging
|
||||
import aiohttp
|
||||
|
||||
from open_webui.config import WEBUI_FAVICON_URL
|
||||
from open_webui.env import AIOHTTP_CLIENT_TIMEOUT, VERSION
|
||||
from open_webui.env import AIOHTTP_CLIENT_SESSION_SSL, AIOHTTP_CLIENT_TIMEOUT, VERSION
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -53,7 +53,7 @@ async def post_webhook(name: str, url: str, message: str, event_data: dict) -> b
|
||||
async with aiohttp.ClientSession(
|
||||
trust_env=True, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT)
|
||||
) as session:
|
||||
async with session.post(url, json=payload) as r:
|
||||
async with session.post(url, json=payload, ssl=AIOHTTP_CLIENT_SESSION_SSL) as r:
|
||||
r_text = await r.text()
|
||||
r.raise_for_status()
|
||||
log.debug(f'r.text: {r_text}')
|
||||
|
||||
Reference in New Issue
Block a user