feat: add language support to summary generation payload

- Enhanced the SummaryGenerationPayload struct to include a Language field for better localization.
- Updated enqueueSummaryGenerationTask and ProcessSummaryGeneration methods to handle language context in summary generation tasks.
This commit is contained in:
wizardchen
2026-03-17 17:09:42 +08:00
committed by lyingbug
parent 17da967f92
commit 4e2583e58d
2 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -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)
+1
View File
@@ -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