refac
This commit is contained in:
@@ -978,6 +978,10 @@ OTEL_LOGS_OTLP_SPAN_EXPORTER = os.environ.get(
|
|||||||
# TOOLS/FUNCTIONS PIP OPTIONS
|
# TOOLS/FUNCTIONS PIP OPTIONS
|
||||||
####################################
|
####################################
|
||||||
|
|
||||||
|
ENABLE_PIP_INSTALL_FRONTMATTER_REQUIREMENTS = (
|
||||||
|
os.environ.get("ENABLE_PIP_INSTALL_FRONTMATTER_REQUIREMENTS", "True").lower() == "true"
|
||||||
|
)
|
||||||
|
|
||||||
PIP_OPTIONS = os.getenv("PIP_OPTIONS", "").split()
|
PIP_OPTIONS = os.getenv("PIP_OPTIONS", "").split()
|
||||||
PIP_PACKAGE_INDEX_OPTIONS = os.getenv("PIP_PACKAGE_INDEX_OPTIONS", "").split()
|
PIP_PACKAGE_INDEX_OPTIONS = os.getenv("PIP_PACKAGE_INDEX_OPTIONS", "").split()
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import tempfile
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from open_webui.env import PIP_OPTIONS, PIP_PACKAGE_INDEX_OPTIONS, OFFLINE_MODE
|
from open_webui.env import PIP_OPTIONS, PIP_PACKAGE_INDEX_OPTIONS, OFFLINE_MODE, ENABLE_PIP_INSTALL_FRONTMATTER_REQUIREMENTS
|
||||||
from open_webui.models.functions import Functions
|
from open_webui.models.functions import Functions
|
||||||
from open_webui.models.tools import Tools
|
from open_webui.models.tools import Tools
|
||||||
|
|
||||||
@@ -401,6 +401,10 @@ def get_function_module_from_cache(request, function_id, load_from_db=True):
|
|||||||
|
|
||||||
|
|
||||||
def install_frontmatter_requirements(requirements: str):
|
def install_frontmatter_requirements(requirements: str):
|
||||||
|
if not ENABLE_PIP_INSTALL_FRONTMATTER_REQUIREMENTS:
|
||||||
|
log.info("ENABLE_PIP_INSTALL_FRONTMATTER_REQUIREMENTS is disabled, skipping installation of requirements.")
|
||||||
|
return
|
||||||
|
|
||||||
if OFFLINE_MODE:
|
if OFFLINE_MODE:
|
||||||
log.info("Offline mode enabled, skipping installation of requirements.")
|
log.info("Offline mode enabled, skipping installation of requirements.")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user