srinuksv commited on
Commit
c0d2409
·
verified ·
1 Parent(s): 77832fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -194,7 +194,10 @@ async def save_chat_history(history: dict):
194
  print("Received history:", history['history']) # Debugging line
195
  cleaned_summary = summarize_conversation(llm_client, history['history'])
196
  print("Cleaned summary:", cleaned_summary) # Debugging line
197
- sf.Lead.update(user_id,{'Description': cleaned_summary})
 
 
 
198
  return {"summary": cleaned_summary, "message": "Chat history saved"}
199
  else:
200
  return JSONResponse(status_code=400, content={"message": "Invalid history format"})
 
194
  print("Received history:", history['history']) # Debugging line
195
  cleaned_summary = summarize_conversation(llm_client, history['history'])
196
  print("Cleaned summary:", cleaned_summary) # Debugging line
197
+ cleaned_summary = cleaned_summary.strip(" []'")
198
+ cleaned_summary_list = [item.strip(" '") for item in cleaned_summary.split(',')]
199
+ cleaned_summary_str = ' '.join(cleaned_summary_list)
200
+ sf.Lead.update(user_id,{'Description': cleaned_summary_str})
201
  return {"summary": cleaned_summary, "message": "Chat history saved"}
202
  else:
203
  return JSONResponse(status_code=400, content={"message": "Invalid history format"})