Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

feat: add language support to summary generation payload

wizardchen4e2583e58d04
diff --git a/internal/application/service/knowledge.go b/internal/application/service/knowledge.go
index 9cd224bd6..cb258310b 100644
--- a/internal/application/service/knowledge.go
+++ b/internal/application/service/knowledge.go
@@ -1931,10 +1931,12 @@ func (s *knowledgeService) enqueueSummaryGenerationTask(ctx context.Context,
kbID, knowledgeID string,
) {
tenantID := ctx.Value(types.TenantIDContextKey).(uint64)
+ lang, _ := types.LanguageFromContext(ctx)
payload := types.SummaryGenerationPayload{
TenantID: tenantID,
KnowledgeBaseID: kbID,
KnowledgeID: knowledgeID,
+ Language: lang,
}
payloadBytes, err := json.Marshal(payload)
@@ -1962,8 +1964,11 @@ func (s *knowledgeService) ProcessSummaryGeneration(ctx context.Context, t *asyn
logger.Infof(ctx, "Processing summary generation for knowledge: %s", payload.KnowledgeID)
- // Set tenant context
+ // Set tenant and language context
ctx = context.WithValue(ctx, types.TenantIDContextKey, payload.TenantID)
+ if payload.Language != "" {
+ ctx = context.WithValue(ctx, types.LanguageContextKey, payload.Language)
+ }
// Get knowledge base
kb, err := s.kbService.GetKnowledgeBaseByID(ctx, payload.KnowledgeBaseID)
diff --git a/internal/types/extract_graph.go b/internal/types/extract_graph.go
index 9069cd39f..51310c350 100644
--- a/internal/types/extract_graph.go
+++ b/internal/types/extract_graph.go
@@ -66,6 +66,7 @@ type SummaryGenerationPayload struct {
TenantID uint64 `json:"tenant_id"`
KnowledgeBaseID string `json:"knowledge_base_id"`
KnowledgeID string `json:"knowledge_id"`
+ Language string `json:"language,omitempty"`
}
// KBClonePayload represents the knowledge base clone task payload