This commit is contained in:
Timothy J. Baek 2024-09-06 04:59:20 +02:00
parent 97e331632c
commit bfb12a7851
3 changed files with 7 additions and 21 deletions

6
backend/.gitignore vendored
View File

@ -8,9 +8,5 @@ _test
Pipfile
!/data
/data/*
!/data/litellm
/data/litellm/*
!data/litellm/config.yaml
!data/config.json
/open_webui/data/*
.webui_secret_key

View File

@ -10,6 +10,8 @@ app = typer.Typer()
KEY_FILE = Path.cwd() / ".webui_secret_key"
os.environ["RUNNING_FROM_INIT_PY"] = "true"
@app.command()
def serve(

View File

@ -88,21 +88,9 @@ WEBUI_FAVICON_URL = "https://openwebui.com/favicon.png"
ENV = os.environ.get("ENV", "dev")
PIP_INSTALL = False
try:
importlib.metadata.version("open-webui")
PIP_INSTALL = True
except importlib.metadata.PackageNotFoundError:
pass
FROM_INIT_PY = os.environ.get("FROM_INIT_PY", "False").lower() == "true"
PIP_INSTALL = (
os.environ.get("PIP_INSTALL", "False").lower() == "true"
if os.environ.get("PIP_INSTALL")
else PIP_INSTALL
)
if PIP_INSTALL:
if FROM_INIT_PY:
PACKAGE_DATA = {"version": importlib.metadata.version("open-webui")}
else:
try:
@ -193,7 +181,7 @@ WEBUI_BUILD_HASH = os.environ.get("WEBUI_BUILD_HASH", "dev-build")
DATA_DIR = Path(os.getenv("DATA_DIR", BACKEND_DIR / "data")).resolve()
if PIP_INSTALL:
if FROM_INIT_PY:
NEW_DATA_DIR = Path(os.getenv("DATA_DIR", OPEN_WEBUI_DIR / "data")).resolve()
NEW_DATA_DIR.mkdir(parents=True, exist_ok=True)
@ -212,7 +200,7 @@ if PIP_INSTALL:
FRONTEND_BUILD_DIR = Path(os.getenv("FRONTEND_BUILD_DIR", BASE_DIR / "build")).resolve()
if PIP_INSTALL:
if FROM_INIT_PY:
FRONTEND_BUILD_DIR = Path(
os.getenv("FRONTEND_BUILD_DIR", OPEN_WEBUI_DIR / "frontend")
).resolve()