feat: introduce storage provider configuration and enhance backward compatibility
- Added a new `StorageProviderConfig` struct to the `KnowledgeBase` for improved storage provider management, separating provider selection from storage credentials. - Updated the `UnmarshalJSON` method to auto-populate `StorageProviderConfig` from the legacy `StorageConfig` for backward compatibility. - Refactored various service methods to utilize the new storage provider configuration, ensuring a smooth transition from the legacy system. - Implemented database migrations to add the `storage_provider_config` column and migrate existing data, maintaining compatibility with historical knowledge bases. This update enhances the clarity and flexibility of storage configurations while ensuring compatibility with existing data structures.
This commit is contained in:
+11
-4
@@ -25,9 +25,10 @@ type KnowledgeBase struct {
|
||||
FAQConfig *FAQConfig `json:"faq_config"`
|
||||
EmbeddingModelID string `json:"embedding_model_id"`
|
||||
SummaryModelID string `json:"summary_model_id"`
|
||||
VLMConfig VLMConfig `json:"vlm_config"`
|
||||
StorageConfig StorageConfig `json:"storage_config"`
|
||||
ExtractConfig *ExtractConfig `json:"extract_config"`
|
||||
VLMConfig VLMConfig `json:"vlm_config"`
|
||||
StorageProviderConfig *StorageProviderConfig `json:"storage_provider_config"`
|
||||
StorageConfig StorageConfig `json:"storage_config"`
|
||||
ExtractConfig *ExtractConfig `json:"extract_config"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
// Computed fields (not stored in database)
|
||||
@@ -68,7 +69,13 @@ type VLMConfig struct {
|
||||
ModelID string `json:"model_id"`
|
||||
}
|
||||
|
||||
// StorageConfig represents the storage configuration
|
||||
// StorageProviderConfig stores the KB-level storage provider selection.
|
||||
type StorageProviderConfig struct {
|
||||
Provider string `json:"provider"`
|
||||
}
|
||||
|
||||
// StorageConfig represents the legacy storage configuration (cos_config).
|
||||
// Deprecated: use StorageProviderConfig for provider selection.
|
||||
type StorageConfig struct {
|
||||
SecretID string `json:"secret_id"`
|
||||
SecretKey string `json:"secret_key"`
|
||||
|
||||
Reference in New Issue
Block a user