Files
impactflow_discovery/.env.example
Claude 866bd60225 Persist discovery answers to CSV for reprocessing and recovery
Save each discovery conversation's prompts and answers to durable CSV
files (per-conversation + append-only master log) on both save and
completion, so answers survive an extraction error, can be re-fed to the
AI, and can be reviewed/resumed by the user.

- app/services/answer_store.py: canonical prompt list + atomic CSV writes,
  master append, and read-back helpers (DB stays system of record; CSV
  failures are logged, never fatal).
- discovery router: write CSV on /respond and /complete; new endpoints
  GET /answers, GET /answers.csv, POST /reprocess (shared extraction
  helper; locked profiles return 409).
- discovery.html: prefill/resume from saved answers after an error and a
  "Re-run analysis" button wired to /reprocess.
- scripts/reprocess_csv.py: offline CLI to re-run extraction from a CSV
  (print or --write-db).
- QUESTIONS_DIR / QUESTIONS_MASTER_CSV config, .gitignore, README, tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dg6XWUwprmP5QCL18HxssY
2026-06-19 01:06:40 +00:00

43 lines
1.7 KiB
Bash

ANTHROPIC_API_KEY=your_anthropic_api_key_here
DATABASE_URL=sqlite+aiosqlite:///./data/discovery.db
HOST_BIND_IP=0.0.0.0
HOST_PORT=8011
# Optional: override the Anthropic model used for extraction
ANTHROPIC_MODEL=claude-sonnet-4-6
# Durable CSV copies of discovery questions + answers. The per-conversation
# files live in QUESTIONS_DIR; QUESTIONS_MASTER_CSV is an append-only log of
# every save/complete event across conversations. Both default under ./data.
QUESTIONS_DIR=./data/questions
QUESTIONS_MASTER_CSV=./data/questions_master.csv
# Google OAuth (web client type). Register the redirect URI below as an
# authorized redirect URI in the Google Cloud Console for this client.
GOOGLE_CLIENT_ID=xxxx.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-xxxx
OAUTH_REDIRECT_URI=http://localhost:8011/api/auth/callback
# Random 64-char URL-safe strings. Generate with:
# python -c "import secrets; print(secrets.token_urlsafe(48))"
JWT_SECRET=generate-a-random-64-char-string
IMPACTFLOW_API_KEY=generate-another-random-64-char-string
# JWT lifetimes (minutes / days).
JWT_ACCESS_MINUTES=15
JWT_REFRESH_DAYS=7
# Browser session cookies. COOKIE_SECURE must be true in production (HTTPS);
# set it false ONLY for local http://localhost dev, where Secure cookies are
# never sent. POST_LOGIN_REDIRECT is where the OAuth callback lands the
# browser after setting the session cookies.
COOKIE_SECURE=false
POST_LOGIN_REDIRECT=/static/discovery.html
# Comma-separated allow-list of browser origins for CORS.
CORS_ALLOWED_ORIGINS=http://localhost:8011,http://100.103.206.4:8011
# Optional comma-separated email-domain allow-list (e.g. "computerim.com").
# Empty means any verified Google email is accepted.
ALLOWED_EMAIL_DOMAINS=