Translate newsletter article titles and strip publisher suffix - #1051
Merged
Conversation
Article titles were set verbatim from the scraped source title, so an English newsletter could show a foreign-language headline carrying a publisher suffix like "- Haluan News". The per-article summarizer now also returns the title, translated faithfully into English with any trailing publisher or site name removed, and the generator uses that title instead of the raw source string. The Indonesian pass inherits the clean base title unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Newsletter article titles were copied verbatim from the scraped source, so an English issue could carry a foreign-language headline with its publisher suffix intact (for example
Terungkap Efek Suku Bunga BI ke Bank Bikin Kaget - Haluan News). The per-article summarizer now also returns the title, translated into the newsletter's language and stripped of any trailing publisher or site name, and the generator uses that title instead of the raw source string.Related issues
Closes #1050
Important changes
summarize-article.ts:articleSummarySchemanow requires atitle. The prompt tells the model to translate the article's own title faithfully into English (no paraphrase or summary), keep numbers, tickers, and proper nouns verbatim, pass English titles through unchanged, and drop any trailing- Publisher/| Site/— Outletsuffix.llm-generate-newsletter.ts: the assembled article uses the model's returned title rather thansource.title. A title that fails validation after retries drops the article through the existing summary-failure path, so a dirty or untranslated title never ships.Other changes
Key files to review
apps/mediapulse/agents/content-generation/src/summarize-article.ts- schema field and prompt wording that keeps translation faithful.apps/mediapulse/agents/content-generation/src/llm-generate-newsletter.ts- title now flows from the model throughSummaryOutcomeinto the document.apps/mediapulse/agents/content-generation/src/llm-generate-newsletter.test.ts- provenance assertion for the translated title.How to test
apps/mediapulse/agents/content-generation, runnpx vitest run src/llm-generate-newsletter.test.ts src/run.test.ts src/translate-newsletter.test.ts.- Publishersuffix, and the Indonesian issue shows Indonesian titles.