Spaces:
Sleeping
Sleeping
File size: 2,702 Bytes
570a433 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | ---
title: Second Thoughts
emoji: ποΈ
colorFrom: red
colorTo: gray
sdk: docker
app_port: 7860
pinned: false
short_description: A private space to say the complicated thing out loud.
---
# Second Thoughts
*For exploring the complicated feelings that come with second thoughts β and practicing how to put them into words.*
A support space β not a debate bot β for people sitting with complicated
feelings about a vote they cast: regret, shame, confusion, grief, ambivalence.
It uses reflective, motivational-interviewing-style conversation to help people
process their own experience at their own pace. It does not argue politics,
does not diagnose, and does not push toward any conclusion.
See [`DESIGN.md`](DESIGN.md) for the conversational approach, the guardrails,
and the reasoning behind the product decisions.
## Setup
1. In **Settings β Variables and secrets**, add a secret named
`ANTHROPIC_API_KEY`.
2. Push this repo to the Space. It builds and launches on its own.
Without the secret the UI still loads and explains that it isn't connected to a
model yet β it won't crash or leak a stack trace.
## How it's built
- **Docker SDK**, not Gradio. The interface is a custom mobile-first page
matching the design mockup; Gradio's chat components can't take that shape
without fighting the framework.
- **FastAPI** serves the static page and one streaming endpoint, `POST
/api/chat`. The API key stays server-side and is never sent to the browser.
- **Claude Opus 5**, streaming, with the system prompt marked for prompt
caching (it's long and identical on every turn, so it's cheap to reuse).
## Privacy
Conversations are never persisted. History lives in the browser tab's memory
and is posted back with each turn so the model has context; closing the tab
ends the conversation for good. There is no database, no logging of message
content, and no analytics. Client IPs are held in memory only as rate-limit
counters and are never written down.
If you later add logging or persistence, anonymize it and disclose it clearly
to users **before** they start typing β the whole premise here is that it's
safe to say something out loud.
## Limits
`POST /api/chat` is metered per client: 40 messages an hour, 4,000 characters
a message, and the most recent 40 turns of history. The key is server-side on
a public Space, so the endpoint is open to anyone who finds it.
## Safety
If someone in crisis reaches this bot, it surfaces the 988 Suicide & Crisis
Lifeline (US) proactively rather than waiting to be asked. A persistent
footer carries the same number. This is not a replacement for 988 or for
professional mental health support, and the interface says so.
|