mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-05-24 13:38:55 +08:00

https://github.com/infiniflow/ragflow/issues/2503 ### What problem does this PR solve? _Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR._ ### Type of change - [x] New Feature (non-breaking change which adds functionality) Before: <img width="611" alt="image" src="https://github.com/user-attachments/assets/02a3a1ee-7bfb-4fe0-9b15-11ced69cc8a3"> After: <img width="796" alt="image" src="https://github.com/user-attachments/assets/371136af-8d16-47aa-909b-26609d3ad60e"> <img width="557" alt="image" src="https://github.com/user-attachments/assets/9268362f-2b6a-4ea1-9fe7-659f7292e5e1">
32 lines
768 B
Python
32 lines
768 B
Python
import os
|
|
from enum import Enum
|
|
|
|
from rag.utils.azure_sas_conn import RAGFlowAzureSasBlob
|
|
from rag.utils.azure_spn_conn import RAGFlowAzureSpnBlob
|
|
from rag.utils.minio_conn import RAGFlowMinio
|
|
from rag.utils.s3_conn import RAGFlowS3
|
|
|
|
|
|
class Storage(Enum):
|
|
MINIO = 1
|
|
AZURE_SPN = 2
|
|
AZURE_SAS = 3
|
|
AWS_S3 = 4
|
|
|
|
|
|
class StorageFactory:
|
|
storage_mapping = {
|
|
Storage.MINIO: RAGFlowMinio,
|
|
Storage.AZURE_SPN: RAGFlowAzureSpnBlob,
|
|
Storage.AZURE_SAS: RAGFlowAzureSasBlob,
|
|
Storage.AWS_S3: RAGFlowS3,
|
|
}
|
|
|
|
@classmethod
|
|
def create(cls, storage: Storage):
|
|
return cls.storage_mapping[storage]()
|
|
|
|
|
|
STORAGE_IMPL_TYPE = os.getenv('STORAGE_IMPL', 'MINIO')
|
|
STORAGE_IMPL = StorageFactory.create(Storage[STORAGE_IMPL_TYPE])
|