forked from open-webui/open-webui
Merge pull request #536 from lucasew/backend-data-dir
Unhardcode some stuff, flexibilize dotenv requirement
This commit is contained in:
commit
a243e53bfe
4 changed files with 33 additions and 26 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue