Claude Code Claude Opus 4.6 commited on
Commit
3965107
·
1 Parent(s): 7f6a6e2

Claude Code: add /health endpoint to main.py

Browse files

Fixes "Error: unknown" by adding missing /health endpoint that
HuggingFace Spaces probes for health checks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. main.py +10 -0
main.py CHANGED
@@ -119,6 +119,16 @@ async def root():
119
  """
120
 
121
 
 
 
 
 
 
 
 
 
 
 
122
  @app.get("/api/status")
123
  async def status():
124
  """Get Cain's current status and personality."""
 
119
  """
120
 
121
 
122
+ @app.get("/health")
123
+ async def health():
124
+ """Health check endpoint for HuggingFace Spaces."""
125
+ return {
126
+ "status": "ok",
127
+ "service": "cain",
128
+ "timestamp": datetime.utcnow().isoformat()
129
+ }
130
+
131
+
132
  @app.get("/api/status")
133
  async def status():
134
  """Get Cain's current status and personality."""