RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix: publish wiki event when document is deleted (#18682)
buua4362d15758670e9
diff --git a/internal/ingestion/knowledge_compile/service.go b/internal/ingestion/knowledge_compile/service.goindex 00541a9acd..3f181b4d50 100644--- a/internal/ingestion/knowledge_compile/service.go+++ b/internal/ingestion/knowledge_compile/service.go@@ -100,6 +100,16 @@ func SetModelConfig(llmID, embedding string) {defaultEmbedding = embedding}+// InitializePublisher installs the process-wide publisher used by document+// lifecycle events. API processes publish events but do not own the dataset+// consumer, so they need this producer-only initialization without starting a+// worker.+func InitializePublisher(db *gorm.DB, mq engine.MessageQueue) {+ if defaultPublisher == nil {+ SetScheduler(newScheduler(db, mq, generateHolder(), 2*time.Minute))+ }+}+// defaultDeduperFactory resolves the per-tenant LLM deps and builds the// KB-scoped deduper. On any failure it returns an error so the caller falls// back to the noop deduper (merged products are still written, just withoutdiff --git a/internal/service/document/document.go b/internal/service/document/document.goindex 28fa708295..f15611bde6 100644--- a/internal/service/document/document.go+++ b/internal/service/document/document.go@@ -26,6 +26,7 @@ import ("ragflow/internal/dao""ragflow/internal/engine"+ "ragflow/internal/ingestion/knowledge_compile")// DocumentService document service@@ -49,6 +50,10 @@ func NewDocumentService() *DocumentService {publisher := service.NewMessageQueueTaskPublisher()ingestionTaskSvc := service.NewIngestionTaskService()ingestionTaskSvc.SetTaskPublisher(publisher)+ // Document deletion is handled by the API process, while the dataset-level+ // consumer is owned by the ingestor. Register the shared publisher here so+ // knowledge_compile.PublishDeleted is effective in API processes as well.+ knowledge_compile.InitializePublisher(dao.DB, engine.GetMessageQueueEngine())return &DocumentService{documentDAO: dao.NewDocumentDAO(),ingestionTaskDAO: dao.NewIngestionTaskDAO(),