Hero emotional-safety guardrail + calmer card polish
Hero guardrail (core to the promise, not cosmetic): - New hero.py: the lead story is chosen with a stricter filter than the rest of the brief — very low cortisol/ragebait and no grief/medical/violence terms (cancer, glioblastoma, death, diagnosis, ...). Such constructive-but-charged stories stay among the five; they just never lead by default. - /api/brief applies user avoid-terms FIRST, then lead_with_gentle, so personal boundaries always take precedence over the general guardrail. - Verified live: the brief no longer leads with a glioblastoma story. Card polish (per review): - Secondary cards with no real image are now text-first (no row of empty media bands); hero still always shows media or a typographic fallback. - Inline tuning actions are quiet until hover/focus on pointer devices, and stay visible (softer) on touch — less interface machinery. Tests: hero safety + lead reordering (70 total). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ from pydantic import BaseModel
|
||||
from . import feeds, queries
|
||||
from .db import connect, init_db
|
||||
from .filters import filter_articles, prefs_from_json
|
||||
from .hero import lead_with_gentle
|
||||
from .llm import LocalModelClient
|
||||
from .moods import MOODS
|
||||
from .taxonomy import FLAVORS, TOPICS
|
||||
@@ -280,7 +281,11 @@ def create_app() -> FastAPI:
|
||||
items = data["items"]
|
||||
if not fp.is_empty():
|
||||
# MVP: filter the stored brief DOWN; no refill from outside the brief.
|
||||
# Runs before hero selection, so personal avoid-terms take precedence.
|
||||
items = filter_articles(items, fp, datetime.now(timezone.utc))
|
||||
# Lead with an emotionally-safe story (constructive-but-charged stories
|
||||
# stay in the five, just not as the first thing seen).
|
||||
items = lead_with_gentle(items)
|
||||
return BriefResponse(
|
||||
brief_date=data["brief_date"],
|
||||
title=data["title"],
|
||||
|
||||
Reference in New Issue
Block a user