Imnotchis commited on
Commit
9df5676
·
verified ·
1 Parent(s): 721abcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -402,6 +402,10 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
402
  submitted_answer = saved_answers[task_id]
403
  print(f"[CACHE] Using answer for {task_id}")
404
 
 
 
 
 
405
  else:
406
  submitted_answer = agent(agent_question)
407
 
@@ -425,8 +429,13 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
425
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
426
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
427
  except Exception as e:
428
- print(f"Error running agent on task {task_id}: {e}")
429
- results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
 
 
 
 
 
430
 
431
  if not answers_payload:
432
  print("Agent did not produce any answers to submit.")
 
402
  submitted_answer = saved_answers[task_id]
403
  print(f"[CACHE] Using answer for {task_id}")
404
 
405
+ elif daily_quota_exhausted:
406
+ print(f"[SKIPPED] Daily quota exhausted: {task_id}")
407
+ continue
408
+
409
  else:
410
  submitted_answer = agent(agent_question)
411
 
 
429
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
430
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
431
  except Exception as e:
432
+ print(f"Error running agent on task {task_id}: {e}")
433
+ if is_daily_quota_error(e):
434
+ daily_quota_exhausted = True
435
+ print("[QUOTA] Daily limit reached.")
436
+ print("[QUOTA] Disabling further LLM calls.")
437
+ print("[QUOTA] Continuing with cached answers only.")
438
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
439
 
440
  if not answers_payload:
441
  print("Agent did not produce any answers to submit.")