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:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user