Claude Code commited on
Commit
12a0875
·
1 Parent(s): eba4da7

Claude Code: fix: add error handling to /api/interact endpoint

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -89,14 +89,18 @@ async def interact(request: InteractRequest):
89
  This is a placeholder endpoint. In a full implementation,
90
  this would connect to the OpenClaw agent system.
91
  """
92
- logger.info(f"Interact request: {request.message[:100]}...")
93
-
94
- # Placeholder response - in production, this would call the agent brain
95
- return InteractResponse(
96
- response=f"Cain received: {request.message}",
97
- session_id=request.session_id or "default",
98
- timestamp=datetime.utcnow().isoformat() + "Z"
99
- )
 
 
 
 
100
 
101
  @app.get("/api/status")
102
  async def status():
 
89
  This is a placeholder endpoint. In a full implementation,
90
  this would connect to the OpenClaw agent system.
91
  """
92
+ try:
93
+ logger.info(f"Interact request: {request.message[:100]}...")
94
+
95
+ # Placeholder response - in production, this would call the agent brain
96
+ return InteractResponse(
97
+ response=f"Cain received: {request.message}",
98
+ session_id=request.session_id or "default",
99
+ timestamp=datetime.utcnow().isoformat() + "Z"
100
+ )
101
+ except Exception as e:
102
+ logger.error(f"Interact error: {e}")
103
+ raise HTTPException(status_code=500, detail="Internal processing error")
104
 
105
  @app.get("/api/status")
106
  async def status():