Skip to content

feat: AI features into preferences and Redux store - #8178

Merged
sid-bruno merged 2 commits into
usebruno:mainfrom
naman-bruno:feat/ai-pref
Jun 4, 2026
Merged

sid-bruno merged 2 commits into
usebruno:mainfrom
naman-bruno:feat/ai-pref

Conversation

@naman-bruno

@naman-bruno naman-bruno commented Jun 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description

JIRA

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • New Features

    • Added AI preferences panel with provider configuration and API key management
    • Added support for OpenAI and Anthropic AI providers
    • Added model selection and per-model enablement controls
    • Added master AI feature toggle for enabling/disabling all AI capabilities
  • Chores

    • Added required AI provider SDK and validation dependencies

@coderabbitai

coderabbitai Bot commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 45a08e34-e2dc-4abb-87fe-cf01626b7cc1

📥 Commits

Reviewing files that changed from the base of the PR and between 8f80230 and 39c15c3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • packages/bruno-app/src/components/Preferences/AI/ProviderCard.js
  • packages/bruno-app/src/components/Preferences/AI/StyledWrapper.js
  • packages/bruno-app/src/components/Preferences/AI/index.js
  • packages/bruno-app/src/components/Preferences/index.js
  • packages/bruno-app/src/components/ToggleSwitch/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/app.js
  • packages/bruno-app/src/utils/ai/index.js
  • packages/bruno-electron/package.json
  • packages/bruno-electron/src/index.js
  • packages/bruno-electron/src/ipc/ai/index.js
  • packages/bruno-electron/src/ipc/ai/providers.js
  • packages/bruno-electron/src/store/ai-keys.js
  • packages/bruno-electron/src/store/preferences.js

Walkthrough

This PR introduces a complete AI provider integration across the Bruno renderer and main process. It adds AI preferences to Redux and Electron storage, defines OpenAI/Anthropic provider registry with encrypted key storage, wires IPC handlers for status queries and streaming text generation, and provides frontend UI components and form management for configuring AI providers.

Changes

AI Provider Configuration & Integration

Layer / File(s) Summary
AI Preferences Data Model
packages/bruno-app/src/providers/ReduxStore/slices/app.js, packages/bruno-electron/src/store/preferences.js
Redux initial state and Electron preferences store define AI configuration: enabled flag, per-provider toggles for OpenAI/Anthropic, models map, and default model selection with validation schema.
Provider & Model Registry
packages/bruno-electron/src/ipc/ai/providers.js
Backend provider definitions (OpenAI/Anthropic), model catalog mapping, in-memory SDK instance cache, and helper functions to resolve and enumerate available models based on provider enablement and API key presence.
Encrypted API Key Storage
packages/bruno-electron/src/store/ai-keys.js
AiKeyStore wrapper around electron-store persists encrypted per-provider API keys with CRUD operations, decryption error handling, and key status reporting integrated with SDK cache clearing.
IPC Handlers & Business Logic
packages/bruno-electron/src/ipc/ai/index.js
Main process IPC registration for status reporting (providers, configured keys, available models), API key management with validation, provider connectivity testing, text generation, and streaming with AbortController support and stream lifecycle (chunk/complete/stopped/error events).
Electron Main Process Integration
packages/bruno-electron/package.json, packages/bruno-electron/src/index.js
Adds AI SDK dependencies (ai, @ai-sdk/openai, @ai-sdk/anthropic, zod), imports registerAiIpc, and invokes it during app startup.
Renderer-side AI Utilities
packages/bruno-app/src/utils/ai/index.js
IPC wrapper functions for renderer: getAiStatus, API key management (set/clear/get), provider testing, text generation, and aiStreamText with streamId-based subscription filtering, handler dispatch, and stop/done promise handle.
AI Preferences UI Styling & Provider Card
packages/bruno-app/src/components/Preferences/AI/StyledWrapper.js, packages/bruno-app/src/components/Preferences/AI/ProviderCard.js
Styled wrapper with theme-driven CSS for AI panel layout and ProviderCard component for individual provider config (logo, expandable key management, connection testing, model grid with enable/disable checkboxes).
AI Preferences Panel & Form Management
packages/bruno-app/src/components/Preferences/AI/index.js
Main AI panel component: fetches live status, initializes Formik with Redux preferences and dynamic status provider IDs, debounces saves with 400ms validation, computes provider/model summaries, and renders master toggle plus error/empty states and provider cards.
Preferences Tab Integration
packages/bruno-app/src/components/Preferences/index.js
Wires AI panel into preferences UI: adds IconStars icon import, imports AI component, extends tab-to-panel switch with ai case, and renders new AI tab button.
ToggleSwitch Uniqueness Fix
packages/bruno-app/src/components/ToggleSwitch/index.js
Updates ToggleSwitch to use React's useId() for generating unique checkbox IDs instead of a fixed string, improving behavior when multiple instances exist on the same page.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • usebruno/bruno#8048: Adds the new AI preferences UI (AI tab), Redux state, and renderer/electron IPC plumbing that shares the same ProviderCard, StyledWrapper, AI component, utils/ai wrapper, and electron IPC/provider/key modules.

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno
  • sid-bruno

Poem

🤖 A symphony of keys, encrypted tight,
OpenAI and Anthropic in perfect sight,
From electron's IPC threads to React's dance,
Streaming generation gets its chance,
AI preferences, debounced and bright! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants