Summarize tone: re-summarize in a chosen voice (backend)

POST /reprocess?job=summarize&tone=<voice> persists the voice on the job
row (queue carries only ids, so a sweep re-enqueue keeps it), the LLM
prompt appends 'write every field in a <tone> tone — the tone colors
the wording, never the facts', and the resulting summary records its
tone (SummaryOut.tone). Plain re-summarize clears a previous tone.
Migration tone0000000001 (summaries.tone, processing_jobs.tone).
78 passed, 1 skipped; ruff clean.
This commit is contained in:
avi 2026-09-15 14:24:36 -05:00
commit b63f49241d
11 changed files with 82 additions and 13 deletions

View file

@ -338,6 +338,9 @@ class Summary(Base, PublicIdMixin):
superseded_at: Mapped[datetime | None] = mapped_column(UTCDT())
provider: Mapped[str] = mapped_column(String(80), nullable=False, default="manual")
model: Mapped[str | None] = mapped_column(String(120))
# Voice the LLM was asked to summarize in (e.g. "sarcastic"). NULL =
# neutral house voice. Display-only: the content JSON shape is unchanged.
tone: Mapped[str | None] = mapped_column(String(64))
content: Mapped[dict] = mapped_column(JSONType, nullable=False, default=dict)
edited_by_user: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
@ -417,6 +420,10 @@ class ProcessingJob(Base, PublicIdMixin):
stage: Mapped[str | None] = mapped_column(String(32))
# 0-100 work estimate within the current stage, when known.
progress: Mapped[int | None] = mapped_column()
# Summarize jobs only: the voice the LLM was asked for (persisted so a
# sweep re-enqueue, which carries only (job_type, recording_id), reruns
# the same request). NULL = neutral.
tone: Mapped[str | None] = mapped_column(String(64))
started_at: Mapped[datetime | None] = mapped_column(UTCDT())
finished_at: Mapped[datetime | None] = mapped_column(UTCDT())
# Opaque arq task handle for observability.