LordXido commited on
Commit
88a67b0
·
verified ·
1 Parent(s): 06905c4

Update api_gateway.py

Browse files
Files changed (1) hide show
  1. api_gateway.py +25 -11
api_gateway.py CHANGED
@@ -14,15 +14,32 @@ app = FastAPI(
14
  description="Sovereign orchestration gateway for Codex Spaces",
15
  )
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  @app.get("/health")
18
- async def health():
19
  return {
20
  "status": "ok",
21
  "timestamp": datetime.utcnow().isoformat()
22
  }
23
 
24
  @app.get("/capabilities")
25
- async def capabilities():
26
  return {
27
  "capabilities": list_capabilities()
28
  }
@@ -43,15 +60,12 @@ async def invoke(request: dict):
43
  "status": "accepted"
44
  }
45
 
46
- try:
47
- result, duration = await invoke_capability(capability, payload)
48
- return {
49
- "trace_id": trace_id,
50
- "result": result,
51
- "duration_ms": duration
52
- }
53
- except ValueError as e:
54
- raise HTTPException(status_code=404, detail=str(e))
55
 
56
  @app.post("/wake")
57
  async def wake(request: dict):
 
14
  description="Sovereign orchestration gateway for Codex Spaces",
15
  )
16
 
17
+ # ✅ ADD THIS BLOCK
18
+ @app.get("/")
19
+ def root():
20
+ return {
21
+ "service": "CodexHF API Gateway",
22
+ "status": "running",
23
+ "message": "API gateway online",
24
+ "endpoints": {
25
+ "health": "/health",
26
+ "capabilities": "/capabilities",
27
+ "invoke": "/invoke",
28
+ "wake": "/wake",
29
+ "docs": "/docs"
30
+ }
31
+ }
32
+ # ✅ END ADD
33
+
34
  @app.get("/health")
35
+ def health():
36
  return {
37
  "status": "ok",
38
  "timestamp": datetime.utcnow().isoformat()
39
  }
40
 
41
  @app.get("/capabilities")
42
+ def capabilities():
43
  return {
44
  "capabilities": list_capabilities()
45
  }
 
60
  "status": "accepted"
61
  }
62
 
63
+ result, duration = await invoke_capability(capability, payload)
64
+ return {
65
+ "trace_id": trace_id,
66
+ "result": result,
67
+ "duration_ms": duration
68
+ }
 
 
 
69
 
70
  @app.post("/wake")
71
  async def wake(request: dict):