srinuksv commited on
Commit
ca7d12d
1 Parent(s): 00df497

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -179,8 +179,10 @@ async def save_chat_history(history: dict):
179
  api_name="/chat"
180
  )
181
 
182
- # Update the lead's description with the summary result
183
- sf.Lead.update(user_id, {'Description': result})
 
 
184
 
185
  return {"summary": result, "message": "Chat history saved"}
186
  @app.post("/webhook")
 
179
  api_name="/chat"
180
  )
181
 
182
+ try:
183
+ sf.Lead.update(user_id, {'Description': result})
184
+ except Exception as e:
185
+ return {"error": f"Failed to update lead: {str(e)}"}, 500
186
 
187
  return {"summary": result, "message": "Chat history saved"}
188
  @app.post("/webhook")