Skip to content

Commit 19449cb

Browse files
feat: added rate limit error pop up
1 parent d7fc685 commit 19449cb

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/backend/app_kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ async def input_task_endpoint(input_task: InputTask, request: Request):
185185
"error": str(e),
186186
},
187187
)
188-
raise HTTPException(status_code=400, detail="Error creating plan")
188+
raise HTTPException(status_code=400, detail=f"Error creating plan: {e}")
189189

190190

191191
@app.post("/api/human_feedback")

src/backend/kernel_agents/planner_agent.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,13 @@ async def _create_structured_plan(
434434
return plan, steps
435435

436436
except Exception as e:
437-
logging.exception(f"Error creating structured plan: {e}")
437+
error_message = str(e)
438+
if "Rate limit is exceeded" in error_message:
439+
logging.warning("Rate limit hit. Consider retrying after some delay.")
440+
raise
441+
else:
442+
logging.exception(f"Error creating structured plan: {e}")
443+
438444

439445
# Create a fallback dummy plan when parsing fails
440446
logging.info("Creating fallback dummy plan due to parsing error")

src/frontend/wwwroot/home/home.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@
103103
})
104104
.then((response) => response.json())
105105
.then((data) => {
106+
// Check if 'detail' field contains rate limit error
107+
if (data.detail && data.detail.includes("Rate limit is exceeded")) {
108+
notyf.error("Application temporarily unavailable due to quota limits. Please try again later.");
109+
newTaskPrompt.disabled = false;
110+
startTaskButton.disabled = false;
111+
startTaskButton.classList.remove("is-loading");
112+
hideOverlay();
113+
return;
114+
}
115+
106116
if (data.status == "Plan not created" || data.plan_id == "") {
107117
notyf.error("Unable to create plan for this task.");
108118
newTaskPrompt.disabled = false;

0 commit comments

Comments
 (0)