Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat(oss): add OSSEngineConfig type and register oss provider scheme

bingxiang.chengada481ed6bef
diff --git a/internal/types/knowledgebase.go b/internal/types/knowledgebase.go
index e280f7c8f..462e5829d 100644
--- a/internal/types/knowledgebase.go
+++ b/internal/types/knowledgebase.go
@@ -152,7 +152,7 @@ func (c ChunkingConfig) ResolveParserEngine(fileType string) string {
// StorageProviderConfig stores the KB-level storage provider selection.
// Credentials are managed at the tenant level (StorageEngineConfig).
type StorageProviderConfig struct {
- Provider string `yaml:"provider" json:"provider"` // "local", "minio", "cos", "tos"
+ Provider string `yaml:"provider" json:"provider"` // "local", "minio", "cos", "tos", "s3", "oss"
}
func (c StorageProviderConfig) Value() (driver.Value, error) {
@@ -266,7 +266,7 @@ func InferStorageFromFilePath(filePath string) string {
// e.g. "minio://bucket/key" → "minio", "local://tenant/file.pdf" → "local"
// Returns "" if the path does not use a known provider scheme.
func ParseProviderScheme(filePath string) string {
- for _, provider := range []string{"local", "minio", "cos", "tos", "s3"} {
+ for _, provider := range []string{"local", "minio", "cos", "tos", "s3", "oss"} {
if strings.HasPrefix(filePath, provider+"://") {
return provider
}
diff --git a/internal/types/tenant.go b/internal/types/tenant.go
index 0ee8b1053..6ef1b0075 100644
--- a/internal/types/tenant.go
+++ b/internal/types/tenant.go
@@ -321,15 +321,16 @@ func (c *ParserEngineConfig) Scan(value interface{}) error {
return json.Unmarshal(b, c)
}
-// StorageEngineConfig holds tenant-level storage engine parameters for Local, MinIO, COS, TOS, and S3.
+// StorageEngineConfig holds tenant-level storage engine parameters for Local, MinIO, COS, TOS, S3, and OSS.
// Knowledge bases select which provider to use; parameters are read from here.
type StorageEngineConfig struct {
- DefaultProvider string `json:"default_provider"` // "local", "minio", "cos", "tos", "s3"
+ DefaultProvider string `json:"default_provider"` // "local", "minio", "cos", "tos", "s3", "oss"
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"`
+ OSS *OSSEngineConfig `json:"oss,omitempty"`
}
// LocalEngineConfig is for local file system storage (single-machine deployment only).
@@ -379,6 +380,19 @@ type S3EngineConfig struct {
PathPrefix string `json:"path_prefix"`
}
+// OSSEngineConfig is for Alibaba Cloud OSS (对象存储服务).
+type OSSEngineConfig 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"`
+ UseTempBucket bool `json:"use_temp_bucket"`
+ TempBucketName string `json:"temp_bucket_name"`
+ TempRegion string `json:"temp_region"`
+}
+
// Value implements the driver.Valuer interface for StorageEngineConfig
func (c *StorageEngineConfig) Value() (driver.Value, error) {
if c == nil {