feat: Implement wiki_config updates in knowledge base management

Added functionality to enable updates for the `wiki_config` field in the `KnowledgeBaseConfig` struct. This includes:

1. **Type Definition Update**: Added `WikiConfig` field to `KnowledgeBaseConfig` to allow JSON unmarshaling during update requests.
2. **Service Layer Enhancement**: Updated the `UpdateKnowledgeBase` method to persist changes to `wiki_config` when provided in the request.
3. **Frontend TypeScript Adjustments**: Enhanced type definitions in the frontend to support `wiki_config`, improving IDE autocomplete and type checking.

This fix addresses the critical issue where `wiki_config` was not being updated due to its absence in the `KnowledgeBaseConfig` struct, ensuring proper handling of wiki configurations during knowledge base updates.
This commit is contained in:
wizardchen
2026-04-07 19:36:06 +08:00
parent 33da010605
commit d4d005422d
27 changed files with 3362 additions and 530 deletions
@@ -120,7 +120,7 @@ func (s *agentService) CreateAgentEngine(
// 4.5 Append wiki guidelines if any search target is a wiki KB
for _, target := range config.SearchTargets {
kb, err := s.knowledgeBaseService.GetKnowledgeBaseByIDOnly(ctx, target.KnowledgeBaseID)
if err == nil && kb != nil && kb.Type == types.KnowledgeBaseTypeWiki {
if err == nil && kb != nil && kb.IsWikiEnabled() {
systemPromptTemplate += "\n" + agent.WikiAgentSystemPromptAddendum
break
}
@@ -383,7 +383,7 @@ func (s *agentService) registerTools(
var wikiTenantID uint64
for _, target := range config.SearchTargets {
kb, err := s.knowledgeBaseService.GetKnowledgeBaseByIDOnly(ctx, target.KnowledgeBaseID)
if err == nil && kb.Type == types.KnowledgeBaseTypeWiki {
if err == nil && kb.IsWikiEnabled() {
wikiKBIDs = append(wikiKBIDs, kb.ID)
wikiTenantID = kb.TenantID
}