Amogh1221 commited on
Commit
e0415ea
·
verified ·
1 Parent(s): 50c48a1

Update services/conversation_orchestrator.py

Browse files
services/conversation_orchestrator.py CHANGED
@@ -109,6 +109,11 @@ class ConversationOrchestrator:
109
  except Exception as e:
110
  log.error("handle_message_failed", e)
111
  serinity_logger.error(f"Error in handle_message: {str(e)}")
 
 
 
 
 
112
  fallback_message = "I'm having a little trouble connecting my thoughts right now. Could you repeat that?"
113
  self.session_store.append_message(session_id, "assistant", fallback_message)
114
  return ChatResult(
 
109
  except Exception as e:
110
  log.error("handle_message_failed", e)
111
  serinity_logger.error(f"Error in handle_message: {str(e)}")
112
+ # Rate-limit / quota errors must bubble up so the route can return 429
113
+ # and the frontend shows the "Tokens Exhausted" popup.
114
+ err_msg = str(e).lower()
115
+ if any(k in err_msg for k in ("tokens exhausted", "429", "rate limit", "quota", "exceeded")):
116
+ raise
117
  fallback_message = "I'm having a little trouble connecting my thoughts right now. Could you repeat that?"
118
  self.session_store.append_message(session_id, "assistant", fallback_message)
119
  return ChatResult(