fix(knowledge): wrap locale code with LanguageLocaleName in wiki ingest prompts
The wiki ingest pipeline was passing raw locale codes (e.g. "zh-CN", "en-US") directly into LLM prompts where a human-readable language name is expected. The model would see "zh-CN" instead of "Chinese (Simplified)" in its instructions, which could degrade output quality. Two call sites were affected: - SlugUpdate.Language (ProcessWikiIngest, retract path): consumed by the reduce phase to tell the page editor model what language to write in. - lang variable (mapOneDocument): consumed by entity/concept extraction, chunk citation classification, and index page rebuild — all LLM prompts. Wrap both with types.LanguageLocaleName() which maps locale codes to descriptive names (e.g. "zh-CN" → "Chinese (Simplified)"). Unknown locales fall through unchanged so no information is lost.
This commit is contained in:
@@ -425,7 +425,7 @@ func (s *wikiIngestService) ProcessWikiIngest(ctx context.Context, t *asynq.Task
|
||||
RetractDocContent: op.DocSummary,
|
||||
DocTitle: op.DocTitle,
|
||||
KnowledgeID: op.KnowledgeID,
|
||||
Language: op.Language,
|
||||
Language: types.LanguageLocaleName(op.Language),
|
||||
})
|
||||
}
|
||||
mapMu.Unlock()
|
||||
@@ -770,7 +770,7 @@ func (s *wikiIngestService) mapOneDocument(
|
||||
) (*docIngestResult, []SlugUpdate, error) {
|
||||
docStartedAt := time.Now()
|
||||
knowledgeID := op.KnowledgeID
|
||||
lang := op.Language
|
||||
lang := types.LanguageLocaleName(op.Language)
|
||||
|
||||
// Open a postprocess.wiki subspan under the parent attempt's
|
||||
// postprocess stage so the actual per-doc work (LLM extraction +
|
||||
|
||||
Reference in New Issue
Block a user