feat(storage): 集成S3存储适配器

添加对AWS S3及兼容存储服务的支持:
- 实现完整的S3FileService接口
- 支持文件上传、下载、删除功能
- 添加配置支持和环境变量检查
- 实现连接测试功能
- 遵循与其他存储适配器相同的代码风格
This commit is contained in:
DaWesen
2026-03-07 14:01:22 +08:00
committed by lyingbug
parent e898d62141
commit e309e0bed8
10 changed files with 496 additions and 5 deletions
+13 -2
View File
@@ -317,14 +317,15 @@ func (c *ParserEngineConfig) Scan(value interface{}) error {
return json.Unmarshal(b, c)
}
// StorageEngineConfig holds tenant-level storage engine parameters for Local, MinIO, COS, and TOS.
// StorageEngineConfig holds tenant-level storage engine parameters for Local, MinIO, COS, TOS, and S3.
// Knowledge bases select which provider to use; parameters are read from here.
type StorageEngineConfig struct {
DefaultProvider string `json:"default_provider"` // "local", "minio", "cos", "tos"
DefaultProvider string `json:"default_provider"` // "local", "minio", "cos", "tos", "s3"
Local *LocalEngineConfig `json:"local,omitempty"`
MinIO *MinIOEngineConfig `json:"minio,omitempty"`
COS *COSEngineConfig `json:"cos,omitempty"`
TOS *TOSEngineConfig `json:"tos,omitempty"`
S3 *S3EngineConfig `json:"s3,omitempty"`
}
// LocalEngineConfig is for local file system storage (single-machine deployment only).
@@ -364,6 +365,16 @@ type TOSEngineConfig struct {
PathPrefix string `json:"path_prefix"`
}
// S3EngineConfig is for AWS S3 and S3-compatible object storage.
type S3EngineConfig struct {
Endpoint string `json:"endpoint"`
Region string `json:"region"`
AccessKey string `json:"access_key"`
SecretKey string `json:"secret_key"`
BucketName string `json:"bucket_name"`
PathPrefix string `json:"path_prefix"`
}
// Value implements the driver.Valuer interface for StorageEngineConfig
func (c *StorageEngineConfig) Value() (driver.Value, error) {
if c == nil {