CodeCommunity commited on
Commit
8b33d69
·
verified ·
1 Parent(s): fb9e94f

Update app/core/model_loader.py

Browse files
Files changed (1) hide show
  1. app/core/model_loader.py +2 -4
app/core/model_loader.py CHANGED
@@ -95,8 +95,6 @@ class LLMSingleton:
95
  logger.info("📅 New day detected. Resetting daily AI quotas.")
96
  self.stats["date"] = today
97
  self.stats["daily_requests_count"] = 0
98
- # We don't reset total_requests to keep lifetime stats, or we could.
99
- # Let's keep lifetime stats in 'total_requests' and daily in 'daily_requests_count'.
100
  self._save_stats()
101
 
102
  def _check_rpm_window(self):
@@ -141,7 +139,7 @@ class LLMSingleton:
141
 
142
  if not self.api_key:
143
  logger.error("Cannot generate: Missing GEMINI_API_KEY")
144
- return ""
145
 
146
  # Check daily quota before sending (Gemini 3 Flash Limit)
147
  if self.stats["daily_requests_count"] >= 500:
@@ -198,7 +196,7 @@ class LLMSingleton:
198
  self.stats["errors"] += 1
199
  self._save_stats()
200
  logger.error(f"Gemini generation failed: {e}")
201
- return ""
202
 
203
  self.stats["errors"] += 1
204
  self._save_stats()
 
95
  logger.info("📅 New day detected. Resetting daily AI quotas.")
96
  self.stats["date"] = today
97
  self.stats["daily_requests_count"] = 0
 
 
98
  self._save_stats()
99
 
100
  def _check_rpm_window(self):
 
139
 
140
  if not self.api_key:
141
  logger.error("Cannot generate: Missing GEMINI_API_KEY")
142
+ raise RuntimeError("MISSING_API_KEY")
143
 
144
  # Check daily quota before sending (Gemini 3 Flash Limit)
145
  if self.stats["daily_requests_count"] >= 500:
 
196
  self.stats["errors"] += 1
197
  self._save_stats()
198
  logger.error(f"Gemini generation failed: {e}")
199
+ raise RuntimeError(f"GENERATION_FAILED: {e}")
200
 
201
  self.stats["errors"] += 1
202
  self._save_stats()