Skip to content

fix: remove update popup and handle budget exceeded errors gracefully#5

Open
AhtishamShahid wants to merge 10 commits into
release/v0.7.3-betafrom
fix/remove-update-popup
Open

fix: remove update popup and handle budget exceeded errors gracefully#5
AhtishamShahid wants to merge 10 commits into
release/v0.7.3-betafrom
fix/remove-update-popup

Conversation

@AhtishamShahid

@AhtishamShahid AhtishamShahid commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Removed the app update popup/banner from the Electron desktop app by dropping the startUpdateChecker/stopUpdateChecker integration in electron/app/main.ts
  • Fixed a 400 error shown to users with low API key balance — the budget_exceeded OpenAI error now returns a clean 402 with the message: "Your API key has exceeded its budget limit. Please add credits to your account to continue."
  • Applied the budget exceeded fix to both the web app and Electron desktop app FastAPI servers
  • Fixed eye/visibility toggle in onboarding settings: toggling the eye icon on the Text Generation API key was also revealing the Image Generation API key (and vice versa). Added a separate showImageApiKey state so each section's toggle is independent.

Test plan

  • Launch the desktop app and confirm no update banner appears
  • Configure an OpenAI API key that has exceeded its budget, create slides, select a template, and verify the user-friendly error message is shown instead of the raw OpenAI error string
  • Confirm normal presentation generation still works with a valid key
  • On the onboarding settings page, enter keys in both Text and Image sections, click the eye icon on Text — confirm only the Text key is revealed and the Image key stays masked, and vice versa

Removed the update checker integration from the Electron app by
dropping the import and all calls to startUpdateChecker/stopUpdateChecker
in main.ts so the update banner no longer appears.
When the OpenAI API key runs out of budget it returns a 400 with
type=budget_exceeded. The error handler was forwarding the raw OpenAI
error string to the UI. Now detect that specific error type and return
a clean 402 with an actionable message instead.

Applied to both web app and Electron desktop app FastAPI servers.
Copilot AI review requested due to automatic review settings June 9, 2026 07:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the Electron desktop app’s update-checker integration (and thus the update popup/banner) and improves user-facing handling of OpenAI “budget exceeded” errors by mapping them to a clean 402 response with a friendly message in both the web and Electron FastAPI servers.

Changes:

  • Removed startUpdateChecker / stopUpdateChecker wiring from the Electron main process to prevent update banners from being shown.
  • Added OpenAI error inspection in the FastAPI LLM error handler to detect “budget exceeded” and return HTTP 402 with a user-friendly message.
  • Applied the same budget-exceeded handling to both servers/fastapi and electron/servers/fastapi.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
servers/fastapi/utils/llm_client_error_handler.py Detects OpenAI budget-exceeded errors and returns a friendly 402 response.
electron/servers/fastapi/utils/llm_client_error_handler.py Mirrors the same OpenAI budget-exceeded handling for the Electron-bundled FastAPI server.
electron/app/main.ts Removes update-checker integration to eliminate the update popup/banner.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread electron/app/main.ts
The update checker was disabled in a prior commit. Remove the now-unused
update-checker.ts module, generate_update.js script, version.json, and
the generate:version npm script from build:electron.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread servers/fastapi/utils/llm_client_error_handler.py Outdated
Comment thread electron/servers/fastapi/utils/llm_client_error_handler.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment on lines +13 to +18
error_body = getattr(e, "body", None) or {}
error_type = (
error_body.get("error", {}).get("type", "")
if isinstance(error_body, dict)
else ""
)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 0299c7c1. Extracted error_obj separately and guarded it with isinstance(error_obj, dict) before calling .get('type', ''), so a non-dict error value no longer raises AttributeError.

Comment on lines +13 to +18
error_body = getattr(e, "body", None) or {}
error_type = (
error_body.get("error", {}).get("type", "")
if isinstance(error_body, dict)
else ""
)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 0299c7c1. Same fix applied to electron/servers/fastapi/utils/llm_client_error_handler.py.

Text and image API key visibility toggles shared a single showApiKey
state, causing both fields to reveal/hide together. Added a separate
showImageApiKey state for all image provider API key inputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants