Add default collection and document model settings in Config struct
- Introduced default values for CollectionModel and DocumentModel in the Config struct to ensure proper initialization. - Updated UnmarshalJSON method to set these defaults if not explicitly configured, enhancing the robustness of the configuration handling.
This commit is contained in:
parent
bab6eec3c3
commit
d3e649ebfe
2 changed files with 16 additions and 0 deletions
|
|
@ -323,6 +323,16 @@ func (c *Config) UnmarshalJSON(data []byte) error {
|
||||||
c.Uploader = "__yao.attachment"
|
c.Uploader = "__yao.attachment"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set default collection model if not configured
|
||||||
|
if c.CollectionModel == "" {
|
||||||
|
c.CollectionModel = "__yao.kb.collection"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set default document model if not configured
|
||||||
|
if c.DocumentModel == "" {
|
||||||
|
c.DocumentModel = "__yao.kb.document"
|
||||||
|
}
|
||||||
|
|
||||||
// Note: Features will be computed later after providers are loaded
|
// Note: Features will be computed later after providers are loaded
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,12 @@ type Config struct {
|
||||||
// KV store name (Optional with default value)
|
// KV store name (Optional with default value)
|
||||||
Store string `json:"store,omitempty" yaml:"store,omitempty"` // Default: "__yao.kb.store"
|
Store string `json:"store,omitempty" yaml:"store,omitempty"` // Default: "__yao.kb.store"
|
||||||
|
|
||||||
|
// Bind Collection Model
|
||||||
|
CollectionModel string `json:"collection_model,omitempty" yaml:"collection_model,omitempty"` // Default: "__yao.kb.collection"
|
||||||
|
|
||||||
|
// Bind Document Model
|
||||||
|
DocumentModel string `json:"document_model,omitempty" yaml:"document_model,omitempty"` // Default: "__yao.kb.document"
|
||||||
|
|
||||||
// PDF parser configuration (Optional)
|
// PDF parser configuration (Optional)
|
||||||
PDF *PDFConfig `json:"pdf,omitempty" yaml:"pdf,omitempty"`
|
PDF *PDFConfig `json:"pdf,omitempty" yaml:"pdf,omitempty"`
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue