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:
parent
0d8f3be614
commit
b63f49241d
11 changed files with 82 additions and 13 deletions
|
|
@ -437,12 +437,14 @@ async def run_summarize(ctx: dict, recording_id: str) -> None:
|
|||
rec.processing_status = ProcessingStatus.processing
|
||||
await session.commit() # visible before the long LLM call
|
||||
try:
|
||||
result = await provider.summarize(text, title=rec.title)
|
||||
result = await provider.summarize(text, title=rec.title,
|
||||
tone=job.tone)
|
||||
except AIError as e:
|
||||
await _fail(session, rec, job, str(e), ctx, e)
|
||||
await session.commit()
|
||||
return
|
||||
await store_summary(session, rec, result.to_dict(), provider.name, result.model)
|
||||
await store_summary(session, rec, result.to_dict(), provider.name,
|
||||
result.model, tone=job.tone)
|
||||
job.status = JobStatus.succeeded
|
||||
job.stage = None
|
||||
job.progress = 100
|
||||
|
|
@ -506,6 +508,7 @@ async def store_summary(
|
|||
content: dict,
|
||||
provider_name: str,
|
||||
model: str,
|
||||
tone: str | None = None,
|
||||
) -> None:
|
||||
existing = (
|
||||
await session.scalars(
|
||||
|
|
@ -531,6 +534,7 @@ async def store_summary(
|
|||
version=(max_version or 0) + 1,
|
||||
provider=provider_name,
|
||||
model=model,
|
||||
tone=tone,
|
||||
content=content,
|
||||
edited_by_user=False,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue