feat: add knowledge management functionality with CRUD operations and database schema

- Implemented KnowledgeHandler for managing knowledge groups and items, including listing, creating, updating, and deleting operations.
- Added database migration scripts to create necessary tables for knowledge management, including knowledge_groups, knowledge_items, knowledge_parse_tasks, and knowledge_chunks_meta.
- Introduced prompt_rule_knowledge_groups table to associate prompt rules with knowledge groups.
This commit is contained in:
2026-04-05 17:14:13 +08:00
parent 134dd063c3
commit 446f865cdf
62 changed files with 9503 additions and 2664 deletions
@@ -49,7 +49,7 @@ func TestBuildGenerationPromptAddsTopXBrandPriorityRules(t *testing.T) {
"topic": "合肥全屋定制",
"brand_name": "安徽海翔家居用品销售有限公司",
"locale": "zh-CN",
})
}, "")
for _, expected := range []string{
"模板专项要求:",
@@ -68,7 +68,7 @@ func TestBuildGenerationPromptDoesNotAddTopXBrandRulesForOtherTemplates(t *testi
prompt := buildGenerationPrompt("product_review", "产品评测", nil, map[string]interface{}{
"product_name": "测试产品",
"brand_name": "安徽海翔家居用品销售有限公司",
})
}, "")
if strings.Contains(prompt, "排在第 1 位") {
t.Fatalf("buildGenerationPrompt() = %q, should not include top-x ranking rules", prompt)