mirror of
https://github.com/open-webui/open-webui.git
synced 2025-03-17 21:32:42 +01:00
Merge pull request #11163 from tidely/pathfix
chore: Use platform specific path separators
This commit is contained in:
commit
f39556b933
@ -699,16 +699,16 @@ AZURE_STORAGE_KEY = os.environ.get("AZURE_STORAGE_KEY", None)
|
|||||||
# File Upload DIR
|
# File Upload DIR
|
||||||
####################################
|
####################################
|
||||||
|
|
||||||
UPLOAD_DIR = f"{DATA_DIR}/uploads"
|
UPLOAD_DIR = DATA_DIR / "uploads"
|
||||||
Path(UPLOAD_DIR).mkdir(parents=True, exist_ok=True)
|
UPLOAD_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Cache DIR
|
# Cache DIR
|
||||||
####################################
|
####################################
|
||||||
|
|
||||||
CACHE_DIR = f"{DATA_DIR}/cache"
|
CACHE_DIR = DATA_DIR / "cache"
|
||||||
Path(CACHE_DIR).mkdir(parents=True, exist_ok=True)
|
CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
|
@ -54,7 +54,7 @@ MAX_FILE_SIZE = MAX_FILE_SIZE_MB * 1024 * 1024 # Convert MB to bytes
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
log.setLevel(SRC_LOG_LEVELS["AUDIO"])
|
log.setLevel(SRC_LOG_LEVELS["AUDIO"])
|
||||||
|
|
||||||
SPEECH_CACHE_DIR = Path(CACHE_DIR).joinpath("./audio/speech/")
|
SPEECH_CACHE_DIR = CACHE_DIR / "audio" / "speech"
|
||||||
SPEECH_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
SPEECH_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ async def create_new_function(
|
|||||||
|
|
||||||
function = Functions.insert_new_function(user.id, function_type, form_data)
|
function = Functions.insert_new_function(user.id, function_type, form_data)
|
||||||
|
|
||||||
function_cache_dir = Path(CACHE_DIR) / "functions" / form_data.id
|
function_cache_dir = CACHE_DIR / "functions" / form_data.id
|
||||||
function_cache_dir.mkdir(parents=True, exist_ok=True)
|
function_cache_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
if function:
|
if function:
|
||||||
|
@ -25,7 +25,7 @@ from pydantic import BaseModel
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
log.setLevel(SRC_LOG_LEVELS["IMAGES"])
|
log.setLevel(SRC_LOG_LEVELS["IMAGES"])
|
||||||
|
|
||||||
IMAGE_CACHE_DIR = Path(CACHE_DIR).joinpath("./image/generations/")
|
IMAGE_CACHE_DIR = CACHE_DIR / "image" / "generations"
|
||||||
IMAGE_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
IMAGE_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ async def speech(request: Request, user=Depends(get_verified_user)):
|
|||||||
body = await request.body()
|
body = await request.body()
|
||||||
name = hashlib.sha256(body).hexdigest()
|
name = hashlib.sha256(body).hexdigest()
|
||||||
|
|
||||||
SPEECH_CACHE_DIR = Path(CACHE_DIR).joinpath("./audio/speech/")
|
SPEECH_CACHE_DIR = CACHE_DIR / "audio" / "speech"
|
||||||
SPEECH_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
SPEECH_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
file_path = SPEECH_CACHE_DIR.joinpath(f"{name}.mp3")
|
file_path = SPEECH_CACHE_DIR.joinpath(f"{name}.mp3")
|
||||||
file_body_path = SPEECH_CACHE_DIR.joinpath(f"{name}.json")
|
file_body_path = SPEECH_CACHE_DIR.joinpath(f"{name}.json")
|
||||||
|
@ -105,7 +105,7 @@ async def create_new_tools(
|
|||||||
specs = get_tools_specs(TOOLS[form_data.id])
|
specs = get_tools_specs(TOOLS[form_data.id])
|
||||||
tools = Tools.insert_new_tool(user.id, form_data, specs)
|
tools = Tools.insert_new_tool(user.id, form_data, specs)
|
||||||
|
|
||||||
tool_cache_dir = Path(CACHE_DIR) / "tools" / form_data.id
|
tool_cache_dir = CACHE_DIR / "tools" / form_data.id
|
||||||
tool_cache_dir.mkdir(parents=True, exist_ok=True)
|
tool_cache_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
if tools:
|
if tools:
|
||||||
|
@ -110,7 +110,7 @@ class PDFGenerator:
|
|||||||
# When running using `pip install -e .` the static directory is in the site packages.
|
# When running using `pip install -e .` the static directory is in the site packages.
|
||||||
# This path only works if `open-webui serve` is run from the root of this project.
|
# This path only works if `open-webui serve` is run from the root of this project.
|
||||||
if not FONTS_DIR.exists():
|
if not FONTS_DIR.exists():
|
||||||
FONTS_DIR = Path("./backend/static/fonts")
|
FONTS_DIR = Path(".") / "backend" / "static" / "fonts"
|
||||||
|
|
||||||
pdf.add_font("NotoSans", "", f"{FONTS_DIR}/NotoSans-Regular.ttf")
|
pdf.add_font("NotoSans", "", f"{FONTS_DIR}/NotoSans-Regular.ttf")
|
||||||
pdf.add_font("NotoSans", "b", f"{FONTS_DIR}/NotoSans-Bold.ttf")
|
pdf.add_font("NotoSans", "b", f"{FONTS_DIR}/NotoSans-Bold.ttf")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user