Spaces:
Sleeping
Sleeping
feat: add friendly root endpoint with API info
Browse files- teeunit_env/server/app.py +31 -0
teeunit_env/server/app.py
CHANGED
|
@@ -31,6 +31,37 @@ try:
|
|
| 31 |
app = create_app(
|
| 32 |
TeeEnvironment, CallToolAction, CallToolObservation, env_name="teeunit_env"
|
| 33 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
except ImportError:
|
| 36 |
# Fallback: Create a simple FastAPI app for development/testing
|
|
|
|
| 31 |
app = create_app(
|
| 32 |
TeeEnvironment, CallToolAction, CallToolObservation, env_name="teeunit_env"
|
| 33 |
)
|
| 34 |
+
|
| 35 |
+
# Add a friendly root endpoint
|
| 36 |
+
@app.get("/")
|
| 37 |
+
async def root():
|
| 38 |
+
"""Welcome page with API information."""
|
| 39 |
+
return {
|
| 40 |
+
"name": "TeeUnit Environment",
|
| 41 |
+
"description": "OpenEnv-compatible Teeworlds arena for LLM-based RL training",
|
| 42 |
+
"version": "0.1.0",
|
| 43 |
+
"status": "running",
|
| 44 |
+
"docs": "/docs",
|
| 45 |
+
"endpoints": {
|
| 46 |
+
"health": "GET /health - Health check",
|
| 47 |
+
"reset": "POST /reset - Reset environment",
|
| 48 |
+
"step": "POST /step - Execute action",
|
| 49 |
+
"state": "GET /state - Get current state",
|
| 50 |
+
"metadata": "GET /metadata - Environment info",
|
| 51 |
+
"schema": "GET /schema - Action/Observation schema",
|
| 52 |
+
"websocket": "WS /ws - Stateful WebSocket session (recommended for RL)",
|
| 53 |
+
},
|
| 54 |
+
"tools": ["move", "jump", "aim", "shoot", "hook", "get_status"],
|
| 55 |
+
"example": {
|
| 56 |
+
"websocket": "Connect to wss://ziadbc-teeunit-env.hf.space/ws for stateful sessions",
|
| 57 |
+
"reset": {"type": "reset", "data": {}},
|
| 58 |
+
"step": {
|
| 59 |
+
"type": "step",
|
| 60 |
+
"data": {"type": "call_tool", "tool_name": "get_status", "arguments": {}}
|
| 61 |
+
}
|
| 62 |
+
},
|
| 63 |
+
"github": "https://github.com/ziadgit/teeunit",
|
| 64 |
+
}
|
| 65 |
|
| 66 |
except ImportError:
|
| 67 |
# Fallback: Create a simple FastAPI app for development/testing
|