ethiotech4848 commited on
Commit
fa89e18
·
verified ·
1 Parent(s): 4f18a2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -117,15 +117,15 @@ async def ask(request: Request):
117
  else:
118
  print("⚠️ No token usage info returned from API")
119
 
120
- except Exception as e:
121
- print("❌ OpenAI Error:", e)
122
- answer = "Sorry, I'm having trouble answering right now."
123
-
124
- if answer == "I'm not sure about that. Let me connect you with a human agent.":
125
- stop_reply_conversations.add(conversation_id)
126
- print(f"🚫 Fallback answer, disabling AI for conversation {conversation_id}")
127
-
128
- await send_chatwoot_message(conversation_id, answer)
129
 
130
  return {"status": "ok"}
131
 
 
117
  else:
118
  print("⚠️ No token usage info returned from API")
119
 
120
+ except Exception as e:
121
+ print("❌ OpenAI Error:", e)
122
+ answer = "Sorry, I'm having trouble answering right now."
123
+
124
+ if answer == "I'm not sure about that. Let me connect you with a human agent.":
125
+ stop_reply_conversations.add(conversation_id)
126
+ print(f"🚫 Fallback answer, disabling AI for conversation {conversation_id}")
127
+
128
+ await send_chatwoot_message(conversation_id, answer)
129
 
130
  return {"status": "ok"}
131