feat: enhance knowledge update functionality
- Added support for updating the description field in knowledge records, improving the detail and context of knowledge entries. - Refactored knowledge base update logic to ensure configuration updates are only applied when provided, enhancing robustness and preventing unnecessary overwrites. - Modified the request structure to make the configuration field optional, allowing for more flexible updates. These changes improve the knowledge management system by allowing for more comprehensive updates and better handling of configuration data.main
parent
421c83452c
commit
a6f77cec14
|
|
@ -2434,6 +2434,9 @@ func (s *knowledgeService) UpdateKnowledge(ctx context.Context, knowledge *types
|
|||
if knowledge.Title != "" {
|
||||
record.Title = knowledge.Title
|
||||
}
|
||||
if knowledge.Description != "" {
|
||||
record.Description = knowledge.Description
|
||||
}
|
||||
|
||||
// Update knowledge record in the repository
|
||||
if err := s.repo.UpdateKnowledge(ctx, record); err != nil {
|
||||
|
|
|
|||
|
|
@ -291,11 +291,12 @@ func (s *knowledgeBaseService) UpdateKnowledgeBase(ctx context.Context,
|
|||
// Update the knowledge base properties
|
||||
kb.Name = name
|
||||
kb.Description = description
|
||||
kb.ChunkingConfig = config.ChunkingConfig
|
||||
kb.ImageProcessingConfig = config.ImageProcessingConfig
|
||||
// Update FAQ config if provided
|
||||
if config.FAQConfig != nil {
|
||||
kb.FAQConfig = config.FAQConfig
|
||||
if config != nil {
|
||||
kb.ChunkingConfig = config.ChunkingConfig
|
||||
kb.ImageProcessingConfig = config.ImageProcessingConfig
|
||||
if config.FAQConfig != nil {
|
||||
kb.FAQConfig = config.FAQConfig
|
||||
}
|
||||
}
|
||||
kb.UpdatedAt = time.Now()
|
||||
kb.EnsureDefaults()
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ func (h *KnowledgeBaseHandler) TogglePinKnowledgeBase(c *gin.Context) {
|
|||
type UpdateKnowledgeBaseRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Description string `json:"description"`
|
||||
Config *types.KnowledgeBaseConfig `json:"config" binding:"required"`
|
||||
Config *types.KnowledgeBaseConfig `json:"config"`
|
||||
}
|
||||
|
||||
// UpdateKnowledgeBase godoc
|
||||
|
|
|
|||
Loading…
Reference in New Issue