CoolFace
Apppublic

Bigshot1136/SafeSupport

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

<p align="center"> <img src="assets/safesupport-logo.svg" alt="SafeSupport Logo" width="100%" /> </p>

SafeSupport

SafeSupport is an AI-powered support training platform where users practice customer support decisions, get instant grader feedback, and track performance analytics over time.

Key Features

  • —Real-time support scenario simulation by difficulty (easy, medium, hard)
  • —Grader feedback with score breakdown and final reward
  • —Per-user episode history and metrics
  • —Supabase-authenticated user profiles and analytics
  • —Dockerized deployment with both backend services running in one container

Project Structure

  • —backend/ FastAPI API, environment server, training and analytics routes
  • —frontend/ React + Vite application
  • —assets/ branding assets (logo)
  • —Dockerfile production multi-stage build for frontend + backend
  • —start.sh starts environment server and API server together

Architecture

  1. 1.Frontend calls API routes under /api/*
  2. 2.API server processes auth and business logic
  3. 3.API server calls environment server for reset/grading
  4. 4.Episode results are persisted in Supabase (episodes, user_stats, profiles)
  5. 5.Analytics endpoints read aggregated user-specific data

Local Development

Prerequisites

  • —Python 3.11+
  • —Node.js 20+
  • —Supabase project credentials

Backend

  1. 1.cd backend
  2. 2.pip install -r requirements.txt
  3. 3.Set environment variables:
  4. 4.SUPABASE_URL
  5. 5.SUPABASE_SERVICE_ROLE_KEY
  6. 6.VITE_SUPABASE_URL
  7. 7.VITE_SUPABASE_ANON_KEY
  8. 8.Run services:
  9. 9.uvicorn safesupport_env.server.app:app --host 0.0.0.0 --port 8001 --reload
  10. 10.uvicorn api.main:app --host 0.0.0.0 --port 8000 --reload

Frontend

  1. 1.cd frontend
  2. 2.npm install
  3. 3.npm run dev

Deploy to Hugging Face Spaces (Docker)

This repository is already prepared for Docker Spaces.

Required Variables / Secrets

Set these in Space Settings -> Variables and secrets:

  • —SUPABASE_URL
  • —SUPABASE_SERVICE_ROLE_KEY (Secret)
  • —VITE_SUPABASE_URL
  • —VITE_SUPABASE_ANON_KEY

How It Runs

  • —Docker builds frontend assets during image build.
  • —start.sh starts:
  • —safesupport_env.server.app on 8001 (internal)
  • —api.main:app on ${PORT} (default 7860)
  • —API serves frontend static files plus all /api/* endpoints.

API Highlights

  • —POST /api/training/start?task_type=easy|medium|hard
  • —POST /api/training/step
  • —GET /api/analytics/metrics
  • —GET /api/analytics/recent
  • —GET /api/users/me
  • —PUT /api/users/me
  • —GET /health

Troubleshooting

  • —Environment server unavailable: ensure internal env server started successfully.
  • —Episode save failed with RLS: verify user_stats INSERT and UPDATE policies exist.
  • —401 Session expired: re-login and verify Supabase variables are from the same project.

License

This project is provided for educational and demonstration purposes.