From 425da8b6cc14144895c6eba19a70cf5c8881d3cf Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 5 Oct 2026 12:03:19 +0400 Subject: [PATCH] refac --- backend/open_webui/storage/provider.py | 12 +++++++----- backend/requirements-slim.txt | 9 +++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/backend/open_webui/storage/provider.py b/backend/open_webui/storage/provider.py index 919900f752..52424690b8 100644 --- a/backend/open_webui/storage/provider.py +++ b/backend/open_webui/storage/provider.py @@ -5,6 +5,10 @@ import shutil from abc import ABC, abstractmethod from typing import BinaryIO, Dict, Tuple +import boto3 +from botocore.config import Config +from botocore.exceptions import ClientError + from open_webui.config import ( AZURE_STORAGE_CONTAINER_NAME, AZURE_STORAGE_ENDPOINT, @@ -29,12 +33,9 @@ from open_webui.utils.json_codec import JSONCodec from open_webui.env import USE_SLIM if not USE_SLIM: - import boto3 from azure.core.exceptions import ResourceNotFoundError from azure.identity import DefaultAzureCredential from azure.storage.blob import BlobServiceClient - from botocore.config import Config - from botocore.exceptions import ClientError from google.cloud import storage from google.cloud.exceptions import GoogleCloudError, NotFound @@ -338,9 +339,10 @@ class AzureStorageProvider(StorageProvider): def get_storage_provider(storage_provider: str): - if USE_SLIM and storage_provider != 'local': + if USE_SLIM and storage_provider not in ('local', 's3'): raise RuntimeError( - 'Slim requires local file storage. Set STORAGE_PROVIDER=local, or use the standard image to access cloud storage.' + 'Slim supports local and S3 file storage. Set STORAGE_PROVIDER=local or s3, ' + 'or use the standard image for other storage providers.' ) if storage_provider == 'local': Storage = LocalStorageProvider() diff --git a/backend/requirements-slim.txt b/backend/requirements-slim.txt index e5f83c4faf..e9c77f9368 100644 --- a/backend/requirements-slim.txt +++ b/backend/requirements-slim.txt @@ -1,5 +1,5 @@ -# Slim: external AI services, SQLite/PostgreSQL app data, pgvector, local file storage. -# No Playwright, cloud-storage SDKs, or other database clients. +# Slim: external AI services, SQLite/PostgreSQL app data, pgvector, Redis, local/S3 file storage. +# No Playwright, Azure/GCS storage SDKs, or other database clients. # Keep shared package pins aligned with requirements.txt. NumPy is used for cosine scoring. numpy==2.4.6 typer==0.25.1 @@ -12,6 +12,8 @@ itsdangerous==2.2.0 python-socketio==5.16.2 orjson==3.11.9 cryptography==48.0.0 +pyotp==2.9.0 +qrcode==8.2 bcrypt==5.0.0 argon2-cffi==25.1.0 PyJWT[crypto]==2.13.0 @@ -81,6 +83,9 @@ azure-search-documents==12.0.0 psycopg2-binary==2.9.12 pgvector==0.4.2 +## File storage +boto3==1.42.62 + ## LDAP ldap3==2.9.1