30 lines
957 B
Python
30 lines
957 B
Python
import argparse
|
|
import os
|
|
from open_webui import app
|
|
|
|
|
|
def main():
|
|
# Set up Open WebUI environment variables if they're provided
|
|
# These will be set by the Tauri app for proper data persistence
|
|
data_dir = os.environ.get("DATA_DIR")
|
|
if data_dir:
|
|
print(f"Using data directory: {data_dir}")
|
|
# Ensure the data directory exists
|
|
os.makedirs(data_dir, exist_ok=True)
|
|
|
|
# Set additional Open WebUI environment variables for persistence
|
|
os.environ.setdefault("WEBUI_DATA_DIR", data_dir)
|
|
os.environ.setdefault("WEBUI_UPLOAD_DIR", os.path.join(data_dir, "uploads"))
|
|
os.environ.setdefault("WEBUI_CACHE_DIR", os.path.join(data_dir, "cache"))
|
|
|
|
# Create subdirectories
|
|
os.makedirs(os.environ["WEBUI_UPLOAD_DIR"], exist_ok=True)
|
|
os.makedirs(os.environ["WEBUI_CACHE_DIR"], exist_ok=True)
|
|
|
|
# Run the FastAPI app using uvicorn
|
|
app()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|