add GCSStorageProvider

This commit is contained in:
kahghi 2025-01-17 09:39:59 +08:00
parent 7cf4c9c89c
commit 42b7beb8a7

View File

@ -14,6 +14,7 @@ from open_webui.config import (
STORAGE_PROVIDER, STORAGE_PROVIDER,
UPLOAD_DIR, UPLOAD_DIR,
) )
from google.cloud import storage
from open_webui.constants import ERROR_MESSAGES from open_webui.constants import ERROR_MESSAGES
@ -137,6 +138,11 @@ class S3StorageProvider(StorageProvider):
# Always delete from local storage # Always delete from local storage
LocalStorageProvider.delete_all_files() LocalStorageProvider.delete_all_files()
class GCSStorageProvider(StorageProvider):
def __init__(self):
self.gcs_client = storage.Client()
self.bucket_name = GCS_BUCKET_NAME
def get_storage_provider(storage_provider: str): def get_storage_provider(storage_provider: str):
if storage_provider == "local": if storage_provider == "local":