Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat: enhance Scan method in RetrieverEngines to support legacy and current formats
wizardchendd524ffb1cf4
diff --git a/internal/types/tenant.go b/internal/types/tenant.goindex e0444b50e..489042bd3 100644--- a/internal/types/tenant.go+++ b/internal/types/tenant.go@@ -165,7 +165,9 @@ func (c RetrieverEngines) Value() (driver.Value, error) {return json.Marshal(c)}-// Scan implements the sql.Scanner interface, used to convert database value to RetrieverEngines+// Scan implements the sql.Scanner interface, used to convert database value to RetrieverEngines.+// It supports both the legacy bare-array format (e.g. [{...}, {...}]) and the current+// object-wrapped format (e.g. {"engines": [{...}, {...}]}).func (c *RetrieverEngines) Scan(value interface{}) error {if value == nil {return nil@@ -174,7 +176,19 @@ func (c *RetrieverEngines) Scan(value interface{}) error {if !ok {return nil}- return json.Unmarshal(b, c)++ // Try the current object format first: {"engines": [...]}+ if err := json.Unmarshal(b, c); err == nil {+ return nil+ }++ // Fallback: legacy bare-array format: [{...}, {...}]+ var engines []RetrieverEngineParams+ if err := json.Unmarshal(b, &engines); err != nil {+ return fmt.Errorf("retriever_engines: cannot unmarshal as object or array: %w", err)+ }+ c.Engines = engines+ return nil}// ConversationConfig represents the conversation configuration for normal mode