CoolFace
Apppublic

dylanwongjh/project-solace

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
App README

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

bash
pip install -r requirements.txt
cp .env.example .env
# edit .env and add your OPENROUTER_API_KEY
python app.py

Visit 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_CHAIN in app.py for ERIICA's tuned list once this points at the same OpenRouter setup.
  • Debrief/coaching: /api/end_session has 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.json is 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 in app.py needs 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.