feat: deliver the LLM summary reader slice - #11
Merged
Conversation
Introduce an article-summary module that calls an OpenAI-compatible LLM gateway to produce a translated title and canonical Markdown summary for each persisted article. Structured output is validated with zod and persisted alongside a terminal failure reason so the front end can distinguish pending, succeeded, and failed rows. - Add article-summary module (gateway, parser, prompt, repository, service, bootstrap service) under apps/api/src/article-summary/. - Add Prisma migrations for translatedTitle and summaryErrorReason fields; default summary/translatedTitle/summaryErrorReason to empty strings for pending rows. - Remove the public article-content retry endpoint and controller; summary backfill is now handled internally by the bootstrap service, not via a user-facing retry route. - Wire summary scheduling into the feed-ingestion pipeline so new articles are enqueued right after content extraction succeeds. - Expose translatedTitle, summary, and summaryErrorReason in the article list and detail DTOs; keep contentMarkdown internal. - Add LLM_* env vars (base URL, API key, model, concurrency, language, timeout) with validation and typed app-config. - Update web front end to render Markdown summaries with react-markdown and remark-gfm; add translated-title display. - Add brainstorm and plan docs in both en/ and zh-Hans/. - Update e2e and unit tests to cover summary fields, fail-open scheduling, and the removed retry endpoint.
Keep retryable article summary jobs fail-open until the final attempt fails, then persist the failure state once. Update the plan docs to match the new summary fallback behavior.
Document the fail-open regression where retryable article-summary refresh failures could clear usable reader content too early, and note the paired fix and test coverage in both language trees.
Match the Playwright check to the current reader contract, which strips summary title markdown before rendering and keeps the Summary section heading visible.
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
Add an internal LLM summary pipeline that turns persisted article content
into a prepared translated title and a canonical Markdown summary. The API
now exposes
translatedTitle, the reader preferstranslatedTitle ?? title,and the old public
POST /article-content/:id/retryrepair route is gone.Transient gateway failures stay fail-open until retries are exhausted, so a
good summary is not cleared on the first retryable miss.
What changed
article-summaryowns the prompt, gateway call, parser, persistence, andbootstrap backfill for rows with
contentMarkdownbut no complete result.ArticleContentServiceschedules summary work after body persistence, andfeed ingestion no longer overwrites prepared summaries with feed text.
GET /articlesandGET /articles/:idnow returntranslatedTitleso theUI can do
translatedTitle ?? titlewithout parsing Markdown again.apps/webrenders the stored summary Markdown withreact-markdownandremark-gfm, while keeping stale and empty-state fallbacks visible.contract.
Validation