fix(i18n): use WEKNORA_LANGUAGE env for prompt language fallback instead of hardcoded zh-CN

- Add DefaultLanguage() that reads WEKNORA_LANGUAGE env with zh-CN fallback
- Replace hardcoded zh-CN in LanguageNameFromContext with DefaultLanguage()
- Unify middleware/language.go to use types.DefaultLanguage()
- Add Language field to DocumentProcessPayload (8 enqueue sites + worker restore)
- Add Language field to ImageMultimodalPayload (enqueue + worker restore)
- Propagate language from ImageMultimodalPayload to QuestionGenerationPayload
This commit is contained in:
ochan.kwon
2026-04-01 21:34:17 +09:00
committed by lyingbug
parent 115bc826c2
commit 8a375749f1
5 changed files with 69 additions and 20 deletions
@@ -79,6 +79,9 @@ func (s *ImageMultimodalService) Handle(ctx context.Context, task *asynq.Task) e
payload.ChunkID, payload.ImageURL, payload.EnableOCR, payload.EnableCaption)
ctx = context.WithValue(ctx, types.TenantIDContextKey, payload.TenantID)
if payload.Language != "" {
ctx = context.WithValue(ctx, types.LanguageContextKey, payload.Language)
}
vlmModel, err := s.resolveVLM(ctx, payload.KnowledgeBaseID)
if err != nil {
@@ -437,6 +440,7 @@ func (s *ImageMultimodalService) enqueueQuestionGenerationIfEnabled(ctx context.
KnowledgeBaseID: payload.KnowledgeBaseID,
KnowledgeID: payload.KnowledgeID,
QuestionCount: questionCount,
Language: payload.Language,
}
payloadBytes, err := json.Marshal(taskPayload)
if err != nil {