|
@@ -19,7 +19,7 @@ from open_webui.utils.plugin import load_tool_module_by_id, replace_imports
|
|
from open_webui.utils.tools import get_tool_specs
|
|
from open_webui.utils.tools import get_tool_specs
|
|
from open_webui.utils.auth import get_admin_user, get_verified_user
|
|
from open_webui.utils.auth import get_admin_user, get_verified_user
|
|
from open_webui.utils.access_control import has_access, has_permission
|
|
from open_webui.utils.access_control import has_access, has_permission
|
|
-from open_webui.utils.tools import get_tool_servers_data
|
|
|
|
|
|
+from open_webui.utils.tools import get_tool_servers
|
|
|
|
|
|
from open_webui.env import SRC_LOG_LEVELS
|
|
from open_webui.env import SRC_LOG_LEVELS
|
|
from open_webui.config import CACHE_DIR, ENABLE_ADMIN_WORKSPACE_CONTENT_ACCESS
|
|
from open_webui.config import CACHE_DIR, ENABLE_ADMIN_WORKSPACE_CONTENT_ACCESS
|
|
@@ -32,6 +32,7 @@ log.setLevel(SRC_LOG_LEVELS["MAIN"])
|
|
|
|
|
|
router = APIRouter()
|
|
router = APIRouter()
|
|
|
|
|
|
|
|
+
|
|
############################
|
|
############################
|
|
# GetTools
|
|
# GetTools
|
|
############################
|
|
############################
|
|
@@ -39,18 +40,9 @@ router = APIRouter()
|
|
|
|
|
|
@router.get("/", response_model=list[ToolUserResponse])
|
|
@router.get("/", response_model=list[ToolUserResponse])
|
|
async def get_tools(request: Request, user=Depends(get_verified_user)):
|
|
async def get_tools(request: Request, user=Depends(get_verified_user)):
|
|
-
|
|
|
|
- if not request.app.state.TOOL_SERVERS:
|
|
|
|
- # If the tool servers are not set, we need to set them
|
|
|
|
- # This is done only once when the server starts
|
|
|
|
- # This is done to avoid loading the tool servers every time
|
|
|
|
-
|
|
|
|
- request.app.state.TOOL_SERVERS = await get_tool_servers_data(
|
|
|
|
- request.app.state.config.TOOL_SERVER_CONNECTIONS
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
tools = Tools.get_tools()
|
|
tools = Tools.get_tools()
|
|
- for server in request.app.state.TOOL_SERVERS:
|
|
|
|
|
|
+
|
|
|
|
+ for server in await get_tool_servers(request):
|
|
tools.append(
|
|
tools.append(
|
|
ToolUserResponse(
|
|
ToolUserResponse(
|
|
**{
|
|
**{
|