mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 05:24:02 +00:00
refac
This commit is contained in:
parent
97e331632c
commit
bfb12a7851
6
backend/.gitignore
vendored
6
backend/.gitignore
vendored
@ -8,9 +8,5 @@ _test
|
|||||||
Pipfile
|
Pipfile
|
||||||
!/data
|
!/data
|
||||||
/data/*
|
/data/*
|
||||||
!/data/litellm
|
/open_webui/data/*
|
||||||
/data/litellm/*
|
|
||||||
!data/litellm/config.yaml
|
|
||||||
|
|
||||||
!data/config.json
|
|
||||||
.webui_secret_key
|
.webui_secret_key
|
@ -10,6 +10,8 @@ app = typer.Typer()
|
|||||||
|
|
||||||
KEY_FILE = Path.cwd() / ".webui_secret_key"
|
KEY_FILE = Path.cwd() / ".webui_secret_key"
|
||||||
|
|
||||||
|
os.environ["RUNNING_FROM_INIT_PY"] = "true"
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
def serve(
|
def serve(
|
||||||
|
@ -88,21 +88,9 @@ WEBUI_FAVICON_URL = "https://openwebui.com/favicon.png"
|
|||||||
|
|
||||||
ENV = os.environ.get("ENV", "dev")
|
ENV = os.environ.get("ENV", "dev")
|
||||||
|
|
||||||
PIP_INSTALL = False
|
FROM_INIT_PY = os.environ.get("FROM_INIT_PY", "False").lower() == "true"
|
||||||
try:
|
|
||||||
importlib.metadata.version("open-webui")
|
|
||||||
PIP_INSTALL = True
|
|
||||||
except importlib.metadata.PackageNotFoundError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
if FROM_INIT_PY:
|
||||||
PIP_INSTALL = (
|
|
||||||
os.environ.get("PIP_INSTALL", "False").lower() == "true"
|
|
||||||
if os.environ.get("PIP_INSTALL")
|
|
||||||
else PIP_INSTALL
|
|
||||||
)
|
|
||||||
|
|
||||||
if PIP_INSTALL:
|
|
||||||
PACKAGE_DATA = {"version": importlib.metadata.version("open-webui")}
|
PACKAGE_DATA = {"version": importlib.metadata.version("open-webui")}
|
||||||
else:
|
else:
|
||||||
try:
|
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()
|
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 = Path(os.getenv("DATA_DIR", OPEN_WEBUI_DIR / "data")).resolve()
|
||||||
NEW_DATA_DIR.mkdir(parents=True, exist_ok=True)
|
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()
|
FRONTEND_BUILD_DIR = Path(os.getenv("FRONTEND_BUILD_DIR", BASE_DIR / "build")).resolve()
|
||||||
|
|
||||||
if PIP_INSTALL:
|
if FROM_INIT_PY:
|
||||||
FRONTEND_BUILD_DIR = Path(
|
FRONTEND_BUILD_DIR = Path(
|
||||||
os.getenv("FRONTEND_BUILD_DIR", OPEN_WEBUI_DIR / "frontend")
|
os.getenv("FRONTEND_BUILD_DIR", OPEN_WEBUI_DIR / "frontend")
|
||||||
).resolve()
|
).resolve()
|
||||||
|
Loading…
Reference in New Issue
Block a user