mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 13:40:55 +00:00
commit
73576dfcaf
@ -96,6 +96,12 @@ except importlib.metadata.PackageNotFoundError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
PIP_INSTALL = (
|
||||||
|
os.environ.get("PIP_INSTALL", "False").lower() == "true"
|
||||||
|
if os.environ.get("PIP_INSTALL")
|
||||||
|
else PIP_INSTALL
|
||||||
|
)
|
||||||
|
|
||||||
if PIP_INSTALL:
|
if PIP_INSTALL:
|
||||||
PACKAGE_DATA = {"version": importlib.metadata.version("open-webui")}
|
PACKAGE_DATA = {"version": importlib.metadata.version("open-webui")}
|
||||||
else:
|
else:
|
||||||
@ -192,7 +198,7 @@ if PIP_INSTALL:
|
|||||||
NEW_DATA_DIR.mkdir(parents=True, exist_ok=True)
|
NEW_DATA_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Check if the data directory exists in the package directory
|
# Check if the data directory exists in the package directory
|
||||||
if DATA_DIR.exists():
|
if DATA_DIR.exists() and DATA_DIR != NEW_DATA_DIR:
|
||||||
log.info(f"Moving {DATA_DIR} to {NEW_DATA_DIR}")
|
log.info(f"Moving {DATA_DIR} to {NEW_DATA_DIR}")
|
||||||
for item in DATA_DIR.iterdir():
|
for item in DATA_DIR.iterdir():
|
||||||
dest = NEW_DATA_DIR / item.name
|
dest = NEW_DATA_DIR / item.name
|
||||||
@ -201,10 +207,11 @@ if PIP_INSTALL:
|
|||||||
else:
|
else:
|
||||||
shutil.copy2(item, dest)
|
shutil.copy2(item, dest)
|
||||||
|
|
||||||
DATA_DIR = OPEN_WEBUI_DIR / "data"
|
DATA_DIR = Path(os.getenv("DATA_DIR", OPEN_WEBUI_DIR / "data"))
|
||||||
|
|
||||||
|
|
||||||
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 PIP_INSTALL:
|
||||||
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")
|
||||||
|
Loading…
Reference in New Issue
Block a user