dylanwongjh/project-solace
0
Solace -- foundation build
A scaled-down, AI-Dungeon-flavored front door to Serious Illness Conversation practice. Pick a case file, step into the conversation. No accounts, no scenario authoring, no debrief/coaching yet -- those layer on top later.
Run it locally
pip install -r requirements.txt
cp .env.example .env
# edit .env and add your OPENROUTER_API_KEY
python app.pyVisit http://localhost:7860.
What's here
app.py-- Flask backend. Loads case files, builds the roleplay system prompt per scenario, calls OpenRouter with a model fallback chain, keeps conversation state in a server-side filesystem session (not a cookie -- this is the fix for the 4KB overflow ERIICA hit once history grew).data/scenarios.json-- the case files. Each one has public fields (title, description, difficulty, persona) shown on the picker, and hidden fields (diagnosis, prognosis, personality, emotional state) the nurse never sees directly -- only the model uses them to roleplay.templates/index.html+static/-- single-page frontend, picker view and chat view toggled in JS. No build step.
Extending this later
- Real fallback chain: swap
MODEL_FALLBACK_CHAINinapp.pyfor ERIICA's tuned list once this points at the same OpenRouter setup. - Debrief/coaching:
/api/end_sessionhas a TODO marker -- this is where SPIKES/NURSE evaluation hooks in, reusing the case file's hidden fields as the rubric. - User-created scenarios:
data/scenarios.jsonis meant to be replaced by a database table down the line. Keep the same field shape (patient/proxy,family_context,opening_line) so nothing else inapp.pyneeds to change when authorship moves from a JSON file to nurse-submitted scenarios. - More case files: drop the curated ERIICA case files into this same schema. The picker and chat code don't care how many scenarios exist.
