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
@@ -22,11 +22,23 @@ type ArticleHandler struct {
}
func NewArticleHandler(a *bootstrap.App) *ArticleHandler {
knowledgeSvc := app.NewKnowledgeService(
a.DB,
a.RetrievalProvider,
a.VectorStore,
a.ObjectStorage,
a.Logger,
a.Config.Retrieval,
0,
0,
)
return &ArticleHandler{
svc: app.NewArticleService(a.DB, a.AuditLogs),
promptGenerateSvc: app.NewPromptRuleGenerationService(
a.DB,
a.LLM,
knowledgeSvc,
a.GenerationStreams,
a.Config.Generation,
a.Config.LLM.MaxOutputTokens,