Spaces:
Sleeping
Sleeping
| """Authenticated settings status without exposing secrets. | |
| Reports coach configuration state and durable data readiness. | |
| """ | |
| from fastapi import APIRouter, Depends, Request | |
| from app.config import APP_VERSION | |
| from app.deps import require_login | |
| from app.models import ApiEnvelope, SettingsStatusData, ok | |
| router = APIRouter( | |
| prefix="/api/settings", | |
| tags=["settings"], | |
| dependencies=[Depends(require_login)], | |
| ) | |
| def settings_status(request: Request) -> dict[str, object]: | |
| """Return non-secret application and coach status.""" | |
| settings = request.app.state.settings | |
| paths = request.app.state.paths | |
| data_ok = paths.root.is_dir() and paths.entries.exists() and paths.daily.exists() | |
| return ok( | |
| SettingsStatusData( | |
| app_name=settings.app_name, | |
| app_version=APP_VERSION, | |
| coach_configured=bool(settings.openrouter_api_key), | |
| model=settings.openrouter_model, | |
| data_ok=data_ok, | |
| env=settings.env, | |
| ) | |
| ) | |