mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
Merge pull request #536 from lucasew/backend-data-dir
Unhardcode some stuff, flexibilize dotenv requirement
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
from peewee import *
|
||||
from config import DATA_DIR
|
||||
|
||||
DB = SqliteDatabase("./data/ollama.db")
|
||||
|
||||
DB = SqliteDatabase(f"{DATA_DIR}/ollama.db")
|
||||
DB.connect()
|
||||
|
||||
@@ -11,7 +11,7 @@ import json
|
||||
|
||||
from utils.misc import calculate_sha256
|
||||
|
||||
from config import OLLAMA_API_BASE_URL
|
||||
from config import OLLAMA_API_BASE_URL, DATA_DIR, UPLOAD_DIR
|
||||
from constants import ERROR_MESSAGES
|
||||
|
||||
|
||||
@@ -96,8 +96,7 @@ async def download(
|
||||
file_name = parse_huggingface_url(url)
|
||||
|
||||
if file_name:
|
||||
os.makedirs("./uploads", exist_ok=True)
|
||||
file_path = os.path.join("./uploads", f"{file_name}")
|
||||
file_path = f"{UPLOAD_DIR}/{file_name}"
|
||||
|
||||
return StreamingResponse(
|
||||
download_file_stream(url, file_path, file_name),
|
||||
@@ -109,8 +108,7 @@ async def download(
|
||||
|
||||
@router.post("/upload")
|
||||
def upload(file: UploadFile = File(...)):
|
||||
os.makedirs("./data/uploads", exist_ok=True)
|
||||
file_path = os.path.join("./data/uploads", file.filename)
|
||||
file_path = f"{UPLOAD_DIR}/{file.filename}"
|
||||
|
||||
# Save file in chunks
|
||||
with open(file_path, "wb+") as f:
|
||||
|
||||
Reference in New Issue
Block a user