feat: pre-generated session-title suggestions (#23) #196
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/23-session-title-suggestions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #23. Fifth feature of v3.7.0 Table Tools.
When a GM schedules a session, offer 2–3 on-theme title suggestions generated from the campaign so far — instantly, with no LLM wait (pre-generated in the background).
Backend (
09d19d4)audio_service.generate_session_titles(context, …)— a context-agnostic LLM core (caller passes a pre-built "story so far" string, gets{title, description}pairs back, deduped/capped). Deliberately reusable by #191 (per-occurrence series titles from the previous session). Defensive: returns[]on any LLM/parse failure, never raises; logs counts only.generate_session_title_suggestionsCelery task: assembles bounded campaign context (name/desc/system + storyline + last 3 completed summaries), stores the list +generated_aton the campaign. No-op when no LLM configured.approve_audioenqueues it post-commit, so suggestions refresh on every transcript approval.campaign.next_session_title_suggestions(JSONB) +…_generated_at(migrationd7e8f9a0b1c2).GET /campaigns/{id}/session-title-suggestions(member, instant) +POST …/generate(GM regenerate, 202).Frontend (
<head>)TitleSuggestionscomponent: instant clickable chips below the new-session title input (single-session case); clicking fills the title (still editable). GM-only "↻ Regenerate" with a non-blocking hint + manual refresh; renders nothing for a non-GM with no suggestions.Tests
test_session_title_suggestions.py(generator isolation incl. bad-LLM degradation, endpoint auth, task store + no-op). Full suite 502 pass; migration round-trip verified. Existingapprove_audiotests mock the new.delay().Notes
bot/changes → noBOT_CONTRACT_VERSIONconcern.🤖 Generated with Claude Code
Background-generates 2-3 on-theme next-session title suggestions per campaign so the schedule form can offer them instantly (no LLM wait). - audio_service.generate_session_titles(context, ...): a context-AGNOSTIC LLM core — the caller passes a pre-built "story so far" string and gets back {title, description} pairs (deduped, capped). Designed for reuse by #191 (per-occurrence series titles from the previous session). Defensive: returns [] on any LLM/parse failure, never raises; logs counts only. - generate_session_title_suggestions Celery task: assembles bounded campaign context (name/desc/system + storyline + last 3 completed summaries), calls the generator, stores the list + generated_at on the campaign. No-op when no LLM is configured. - Trigger: approve_audio enqueues it post-commit (fire-and-forget), so suggestions refresh whenever a transcript is approved. - Storage: campaign.next_session_title_suggestions (JSONB) + next_session_title_suggestions_generated_at (migration d7e8f9a0b1c2). - Endpoints: GET /campaigns/{id}/session-title-suggestions (member, instant, no LLM) + POST .../generate (GM manual regenerate, 202). Tests: +test_session_title_suggestions.py (generator isolation incl. bad-LLM degradation, endpoint auth, task store + no-op). Existing approve_audio tests mock the new .delay(). Full suite 502 pass; migration round-trip verified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>