Skip to content

Conversation

@doublefx
Copy link

@doublefx doublefx commented Jan 2, 2026

Base Branch

  • This PR targets the develop branch (required for all feature/fix PRs)

Description

Automatically detects the embedding provider configuration from the backend .env file and applies it to the frontend settings. This eliminates the need for users to manually configure embedding settings in the UI when they've already set them up in the backend.

The feature reads GRAPHITI_EMBEDDER_PROVIDER and related environment variables from the backend, then populates the frontend memory settings accordingly.

Related Issue

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 📚 Documentation
  • ♻️ Refactor
  • 🧪 Test

Area

  • Frontend
  • Backend
  • Fullstack

Checklist

  • I've synced with develop branch
  • I've tested my changes locally
  • I've followed the code principles (SOLID, DRY, KISS)
  • My PR is small and focused (< 400 lines ideally)

CI/Testing Requirements

  • All CI checks pass
  • All existing tests pass
  • New features include test coverage
  • Bug fixes include regression tests

Feature Toggle

  • N/A - Feature is complete and ready for all users

Breaking Changes

Breaking: No

Summary by CodeRabbit

  • New Features

    • Auto-detect backend embedding provider from backend .env and expose a public method to retrieve that config.
    • Added "OpenRouter" as an available embedding provider plus UI to enter/save its API key; global vs project key override supported.
  • Changes

    • Onboarding now checks backend env config in parallel with infrastructure checks.
    • Default memory embedding provider changed from Ollama to OpenAI.
    • Project config can mark OpenRouter key as global.
  • Tests / Mocks

    • Browser-mode mock updated to include backend env embedding config.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 2, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds a new IPC endpoint and preload API to detect backend embedding provider from a backend .env (GRAPHITI_EMBEDDER_PROVIDER); new shared types and IPC constant; main-process .env parsing and mapping helpers; renderer wiring and onboarding/project settings UI updates to support an OpenRouter provider and OpenRouter API key; mock support for browser mode.

Changes

Cohort / File(s) Summary
IPC Types & Settings Types
apps/frontend/src/shared/types/settings.ts, apps/frontend/src/shared/types/ipc.ts
Added BackendEmbeddingProvider union and BackendEnvEmbeddingConfig interface; extended ElectronAPI/IPC types with getBackendEnvEmbeddingConfig(): Promise<IPCResult<BackendEnvEmbeddingConfig>>.
IPC Constants
apps/frontend/src/shared/constants/ipc.ts
Added BACKEND_ENV_GET_EMBEDDING_CONFIG ('backend:env:getEmbeddingConfig').
Main / IPC Handler
apps/frontend/src/main/ipc-handlers/settings-handlers.ts
New BACKEND_ENV_GET_EMBEDDING_CONFIG handler that uses getEffectiveSourcePath, readFileSync, parseEnvFile, and mapEmbeddingProvider to return IPCResult<BackendEnvEmbeddingConfig> (handles missing path/.env and errors).
Preload / Frontend API
apps/frontend/src/preload/api/settings-api.ts
Exposed getBackendEnvEmbeddingConfig on SettingsAPI that invokes the new IPC channel.
Renderer — Onboarding & UI
apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx, apps/frontend/src/renderer/components/project-settings/MemoryBackendSection.tsx, apps/frontend/src/renderer/components/project-settings/SecuritySettings.tsx
Added openrouter provider option and UI for OpenRouter API key (onboarding memory step and project settings); parallelized init to fetch backend env embedding config and apply detected provider when supported; added key visibility/override handling and provider dropdown entries.
Project Types
apps/frontend/src/shared/types/project.ts
Added optional openrouterKeyIsGlobal?: boolean to ProjectEnvConfig.
Mocks
apps/frontend/src/renderer/lib/mocks/settings-mock.ts
Added getBackendEnvEmbeddingConfig mock returning { success: true, data: { embeddingProvider: 'openai', envExists: false, sourcePath: undefined } }.

Sequence Diagram(s)

sequenceDiagram
    participant R as Renderer (MemoryStep / Settings UI)
    participant P as Preload (ipcRenderer)
    participant M as Main process (ipcMain)
    participant FS as File System

    R->>P: getBackendEnvEmbeddingConfig()
    activate P
    P->>M: BACKEND_ENV_GET_EMBEDDING_CONFIG
    activate M

    M->>M: getEffectiveSourcePath()
    alt source path found
        M->>FS: readFileSync(<source>/.env)
        activate FS
        FS-->>M: file contents / error
        deactivate FS
        rect rgb(220,245,255)
        Note over M: parseEnvFile -> extract GRAPHITI_EMBEDDER_PROVIDER\nmapEmbeddingProvider -> BackendEmbeddingProvider
        end
        M-->>P: IPCResult{ success, data:{ embeddingProvider, envExists:true, sourcePath } }
    else no source path or no .env
        M-->>P: IPCResult{ success, data:{ embeddingProvider:'openai', envExists:false, sourcePath:undefined } }
    end
    deactivate M
    P-->>R: IPCResult<BackendEnvEmbeddingConfig>
    deactivate P

    alt success && provider supported
        R->>R: apply detected provider to UI/config (may show OpenRouter key input)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Fix/2.7.2 fixes #300 — modifies apps/frontend/src/main/ipc-handlers/settings-handlers.ts (related source-path / auto-build detection logic that may overlap with the new handler).

Suggested labels

area/fullstack, area/frontend

Suggested reviewers

  • AlexMadera
  • AndyMik90

Poem

🐰 I hopped through .env by lantern light,
Sniffed GRAPHITI_EMBEDDER_PROVIDER just right,
Mapped providers, nudged the UI to play,
OpenRouter now hops into the fray,
A rabbit's config dance—quick, neat, and bright!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: auto-detect embedding provider from backend .env' directly summarizes the primary change—automatically detecting the embedding provider from the backend environment file and applying it to frontend settings.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e5bf58 and 1c390c3.

⛔ Files ignored due to path filters (1)
  • apps/frontend/package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
📒 Files selected for processing (10)
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
  • apps/frontend/src/preload/api/settings-api.ts
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/renderer/components/project-settings/MemoryBackendSection.tsx
  • apps/frontend/src/renderer/components/project-settings/SecuritySettings.tsx
  • apps/frontend/src/renderer/lib/mocks/settings-mock.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/shared/types/project.ts
  • apps/frontend/src/shared/types/settings.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/renderer/lib/mocks/settings-mock.ts
  • apps/frontend/src/preload/api/settings-api.ts
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/types/project.ts
  • apps/frontend/src/shared/types/settings.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/renderer/components/project-settings/SecuritySettings.tsx
  • apps/frontend/src/renderer/components/project-settings/MemoryBackendSection.tsx
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/renderer/lib/mocks/settings-mock.ts
  • apps/frontend/src/preload/api/settings-api.ts
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/types/project.ts
  • apps/frontend/src/shared/types/settings.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/renderer/components/project-settings/SecuritySettings.tsx
  • apps/frontend/src/renderer/components/project-settings/MemoryBackendSection.tsx
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/renderer/lib/mocks/settings-mock.ts
  • apps/frontend/src/preload/api/settings-api.ts
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/types/project.ts
  • apps/frontend/src/shared/types/settings.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/renderer/components/project-settings/SecuritySettings.tsx
  • apps/frontend/src/renderer/components/project-settings/MemoryBackendSection.tsx
🧠 Learnings (4)
📚 Learning: 2025-12-30T16:38:36.314Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Applies to apps/frontend/src/**/*.{ts,tsx,jsx} : Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Applied to files:

  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
📚 Learning: 2025-12-30T16:38:36.314Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Applies to apps/frontend/src/shared/i18n/locales/**/*.json : When implementing new frontend features, add translation keys to all language files (minimum: en/*.json and fr/*.json)

Applied to files:

  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
📚 Learning: 2025-12-30T16:38:36.314Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Applies to apps/backend/integrations/graphiti/**/*.py : Use the Graphiti-provided multi-provider support for LLMs (OpenAI, Anthropic, Azure OpenAI, Ollama, Google AI) via `integrations/graphiti/graphiti_providers.py`

Applied to files:

  • apps/frontend/src/shared/types/settings.ts
📚 Learning: 2025-12-30T16:38:36.314Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Applies to apps/backend/.env* : Enable Electron MCP for E2E testing by setting `ELECTRON_MCP_ENABLED=true` in `.env` and starting the Electron app with `npm run dev`

Applied to files:

  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
  • apps/frontend/src/shared/types/ipc.ts
🧬 Code graph analysis (6)
apps/frontend/src/preload/api/settings-api.ts (1)
apps/frontend/src/shared/types/settings.ts (1)
  • BackendEnvEmbeddingConfig (324-331)
apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx (2)
apps/frontend/src/shared/types/project.ts (1)
  • GraphitiEmbeddingProvider (186-186)
.design-system/src/components/Input.tsx (1)
  • Input (4-24)
apps/frontend/src/main/ipc-handlers/settings-handlers.ts (4)
apps/frontend/scripts/download-python.cjs (1)
  • trimmed (572-572)
apps/frontend/src/shared/types/settings.ts (2)
  • BackendEmbeddingProvider (322-322)
  • BackendEnvEmbeddingConfig (324-331)
apps/frontend/src/main/updater/path-resolver.ts (1)
  • getEffectiveSourcePath (57-89)
apps/frontend/src/renderer/components/settings/utils/hookProxyFactory.ts (1)
  • error (18-18)
apps/frontend/src/shared/types/ipc.ts (1)
apps/frontend/src/shared/types/settings.ts (1)
  • BackendEnvEmbeddingConfig (324-331)
apps/frontend/src/renderer/components/project-settings/SecuritySettings.tsx (2)
apps/frontend/src/renderer/components/settings/utils/hookProxyFactory.ts (2)
  • envConfig (23-23)
  • updateEnvConfig (29-29)
.design-system/src/components/Input.tsx (1)
  • Input (4-24)
apps/frontend/src/renderer/components/project-settings/MemoryBackendSection.tsx (2)
apps/frontend/src/renderer/components/settings/utils/hookProxyFactory.ts (1)
  • envConfig (23-23)
apps/frontend/src/renderer/components/project-settings/index.ts (1)
  • PasswordInput (19-19)
🔇 Additional comments (20)
apps/frontend/src/shared/constants/ipc.ts (1)

409-411: LGTM! Well-structured IPC channel addition.

The new constant follows established naming conventions and is appropriately grouped with other environment configuration channels.

apps/frontend/src/shared/types/project.ts (1)

316-317: LGTM! Consistent field addition.

The new openrouterKeyIsGlobal field follows the same pattern as the existing openaiKeyIsGlobal field, maintaining consistency in how global vs project-specific API keys are tracked.

apps/frontend/src/renderer/lib/mocks/settings-mock.ts (1)

39-47: LGTM! Appropriate browser-mode mock implementation.

The mock correctly returns a default configuration suitable for browser mode, with clear documentation explaining the 'openai' default choice.

apps/frontend/src/preload/api/settings-api.ts (3)

8-10: LGTM! Proper type import.

The BackendEnvEmbeddingConfig import is correctly added and used in the API interface and implementation.


33-34: LGTM! Clean API interface extension.

The method signature is well-typed and consistent with other settings API methods.


68-70: LGTM! Correct IPC implementation.

The implementation properly invokes the IPC channel and returns the correctly typed result.

apps/frontend/src/shared/types/ipc.ts (2)

62-62: LGTM! Required type import added.

The BackendEnvEmbeddingConfig import is correctly added to support the new API method.


591-592: LGTM! ElectronAPI interface properly extended.

The new method is well-documented and follows the established pattern for environment configuration operations.

apps/frontend/src/shared/types/settings.ts (1)

320-331: LGTM! Backend embedding config types are well-defined.

The new BackendEmbeddingProvider union type and BackendEnvEmbeddingConfig interface are correctly structured. The provider union includes all supported embedding providers (including the previously missing 'openrouter'), and the interface is well-documented with clear comments about the source and purpose of each field.

apps/frontend/src/renderer/components/project-settings/SecuritySettings.tsx (2)

50-56: LGTM! OpenRouter visibility state correctly initialized.

The openrouter key is properly added to the showApiKey state object, following the same pattern as the existing providers.


238-293: OpenRouter UI implementation is correct and consistent.

The OpenRouter provider section correctly implements:

  • Global key override logic matching the OpenAI pattern
  • Password visibility toggle
  • Contextual messaging based on global key usage
  • External documentation link

Note: Hardcoded strings like "OpenRouter API Key" and "Using key from App Settings" should ideally use i18n translation keys per coding guidelines. However, all other providers in this file (OpenAI, Voyage, Google, Azure) also use hardcoded strings. This should be addressed as a separate refactor to convert all provider strings consistently.

Based on coding guidelines, all user-facing text should use i18n translation keys instead of hardcoded strings.

apps/frontend/src/renderer/components/project-settings/MemoryBackendSection.tsx (2)

185-204: LGTM! OpenRouter provider selection correctly integrated.

The embedding provider selection correctly includes 'openrouter' in the type cast (line 188) and adds the corresponding SelectItem (line 201), maintaining consistency with existing providers.


296-331: OpenRouter credential handling implemented correctly.

The OpenRouter section properly implements:

  • Global key override detection with visual indicator
  • Conditional messaging based on global key usage
  • PasswordInput with appropriate placeholder
  • Correct state updates to graphitiProviderConfig

Note: Like SecuritySettings.tsx, this component uses hardcoded strings for user-facing text. Per coding guidelines, these should use i18n translation keys. Since all providers in this file follow the same pattern, converting to i18n should be done as a separate, comprehensive refactor.

Based on coding guidelines, all user-facing text should use i18n translation keys instead of hardcoded strings.

apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx (4)

47-66: LGTM! MemoryConfig interface correctly extended.

The openrouterApiKey field is properly added to the MemoryConfig interface (lines 52-53), maintaining consistency with other provider key fields.


140-160: LGTM! OpenRouter validation correctly implemented.

The validation at line 150 correctly requires an API key for the OpenRouter provider, following the same pattern as other key-based providers (OpenAI, Voyage, Google).


162-216: LGTM! OpenRouter settings persistence implemented correctly.

The handleSave function correctly saves the OpenRouter API key to both the settings file (line 179) and the local store (line 199), maintaining consistency with other provider keys.


285-317: OpenRouter UI rendering is complete and consistent.

The OpenRouter provider section correctly implements:

  • API key input with password visibility toggle
  • Appropriate placeholder text
  • External documentation link to OpenRouter keys page
  • Disabled state during save operation

Note: Hardcoded strings like "OpenRouter API Key" and "Get your key from" should ideally use i18n translation keys per coding guidelines. However, all other providers in this file follow the same pattern, so this should be addressed as a separate, comprehensive refactor.

Based on learnings, all user-facing text in the frontend should use i18n translation keys instead of hardcoded strings.

apps/frontend/src/main/ipc-handlers/settings-handlers.ts (3)

1-19: LGTM! Required imports correctly added.

The new imports (readFileSync, BackendEnvEmbeddingConfig, BackendEmbeddingProvider, and getEffectiveSourcePath) are all necessary for the backend embedding config detection feature and are correctly sourced.


538-548: LGTM! Provider mapping logic is clean and maintainable.

The mapEmbeddingProvider function correctly normalizes the environment variable value, validates it against the list of supported providers, and falls back to 'openai' as the default. The array-based validation approach is clear and easy to maintain.


550-600: IPC handler correctly implemented with proper error handling.

The BACKEND_ENV_GET_EMBEDDING_CONFIG handler is well-structured:

  • Gracefully handles missing source paths and .env files by returning default configuration
  • Correctly parses the .env file and maps the provider
  • Includes error logging at line 593 (addressing previous review feedback)
  • Returns appropriate IPCResult with clear success/error states

The logic correctly defaults to 'openai' when the backend .env is missing or the provider is not configured, aligning with the documented default in .env.example.


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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @doublefx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant quality-of-life improvement by automating the setup of embedding providers. It enables the frontend to read the GRAPHITI_EMBEDDER_PROVIDER setting directly from the backend's .env file, ensuring that the application's memory configuration aligns seamlessly with the backend's environment without requiring manual intervention from the user. This change primarily benefits the onboarding experience by reducing configuration steps and potential errors.

Highlights

  • Automated Embedding Provider Detection: The system now automatically detects the embedding provider configuration from the backend's .env file.
  • Streamlined Frontend Setup: Eliminates the need for users to manually configure embedding settings in the UI, especially during the onboarding process.
  • New IPC Channel: Introduced BACKEND_ENV_GET_EMBEDDING_CONFIG to facilitate communication between the main and renderer processes for fetching backend .env settings.
  • .env Parsing Utilities: Added parseEnvFile and mapEmbeddingProvider functions to safely read and interpret GRAPHITI_EMBEDDER_PROVIDER from .env files.
  • Onboarding Integration: The MemoryStep component in the frontend now utilizes this auto-detection feature to pre-populate the embedding provider setting.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a helpful feature to auto-detect the embedding provider from the backend's .env file, which improves the onboarding experience by pre-configuring the memory settings. The implementation is well-structured, adding a new IPC handler to read the configuration in the main process and applying it in the frontend's MemoryStep component.

My review focuses on enhancing the robustness and maintainability of the new code. I've suggested using a dedicated library for .env parsing to handle edge cases gracefully, refactoring a couple of functions for better clarity and conciseness, and improving error handling in the React component. Overall, this is a great addition.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 16a7fa4 and fd6b46d.

📒 Files selected for processing (7)
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
  • apps/frontend/src/preload/api/settings-api.ts
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/renderer/lib/mocks/settings-mock.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/shared/types/settings.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/preload/api/settings-api.ts
  • apps/frontend/src/shared/types/settings.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/renderer/lib/mocks/settings-mock.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/preload/api/settings-api.ts
  • apps/frontend/src/shared/types/settings.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/renderer/lib/mocks/settings-mock.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/preload/api/settings-api.ts
  • apps/frontend/src/shared/types/settings.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/renderer/lib/mocks/settings-mock.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Applies to apps/backend/.env* : Configure memory system credentials in `apps/backend/.env` and validate with `graphiti_config.py`
📚 Learning: 2025-12-30T16:38:36.314Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Applies to apps/backend/.env* : Enable Electron MCP for E2E testing by setting `ELECTRON_MCP_ENABLED=true` in `.env` and starting the Electron app with `npm run dev`

Applied to files:

  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
🧬 Code graph analysis (3)
apps/frontend/src/shared/types/ipc.ts (1)
apps/frontend/src/shared/types/settings.ts (1)
  • BackendEnvEmbeddingConfig (324-331)
apps/frontend/src/preload/api/settings-api.ts (1)
apps/frontend/src/shared/types/settings.ts (1)
  • BackendEnvEmbeddingConfig (324-331)
apps/frontend/src/main/ipc-handlers/settings-handlers.ts (2)
apps/frontend/src/shared/types/settings.ts (2)
  • BackendEmbeddingProvider (322-322)
  • BackendEnvEmbeddingConfig (324-331)
apps/frontend/src/main/updater/path-resolver.ts (1)
  • getEffectiveSourcePath (57-89)
🔇 Additional comments (11)
apps/frontend/src/shared/constants/ipc.ts (1)

398-400: LGTM!

The new IPC channel constant follows the established naming convention and is appropriately grouped with other environment configuration channels.

apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx (1)

76-88: LGTM on the default provider change.

The default embeddingProvider: 'openai' aligns with the backend .env.example documentation, and the comment clearly explains the intent.

apps/frontend/src/renderer/lib/mocks/settings-mock.ts (1)

39-47: LGTM!

The mock implementation correctly returns a default configuration matching the BackendEnvEmbeddingConfig interface, with sensible defaults for browser mode where no backend .env exists.

apps/frontend/src/shared/types/ipc.ts (2)

62-62: LGTM on import addition.

The BackendEnvEmbeddingConfig import is correctly added to support the new ElectronAPI method.


580-582: LGTM on ElectronAPI extension.

The new getBackendEnvEmbeddingConfig method follows the established pattern and correctly returns Promise<IPCResult<BackendEnvEmbeddingConfig>>.

apps/frontend/src/preload/api/settings-api.ts (3)

8-10: LGTM on import additions.

The imports are correctly updated to include BackendEnvEmbeddingConfig.


32-35: LGTM on interface extension.

The getBackendEnvEmbeddingConfig method is correctly added to the SettingsAPI interface with appropriate typing.


68-71: LGTM on implementation.

The implementation correctly invokes the IPC channel and the return type matches the interface definition.

apps/frontend/src/main/ipc-handlers/settings-handlers.ts (3)

2-2: LGTM on import addition.

The readFileSync import is needed for the new .env file reading functionality.


538-557: LGTM on provider mapping.

The mapping function correctly handles all BackendEmbeddingProvider values and provides a sensible default. The normalization with toLowerCase().trim() handles common .env formatting variations.


559-608: LGTM on IPC handler implementation.

The handler correctly:

  • Uses getEffectiveSourcePath() for proper path resolution
  • Returns sensible defaults when source path or .env doesn't exist
  • Parses the .env file and extracts GRAPHITI_EMBEDDER_PROVIDER
  • Has comprehensive error handling

Note: readFileSync is synchronous, but this is acceptable for .env files which are typically small. If this handler is called frequently or the file grows large, consider using async readFile instead.

@AndyMik90 AndyMik90 self-assigned this Jan 2, 2026
doublefx added a commit to doublefx/Auto-Claude that referenced this pull request Jan 2, 2026
Addresses all feedback from code review:

1. Add 'openrouter' to BackendEmbeddingProvider type
   - Updated settings.ts to include 'openrouter' in union type
   - Matches GraphitiEmbeddingProvider type

2. Simplify mapEmbeddingProvider function
   - Replaced switch statement with array-based validation
   - Cleaner, more maintainable code

3. Add error handling and logging
   - Added console.error in catch block for getBackendEnvEmbeddingConfig
   - Improves debugging when .env file read fails

4. Simplify boolean assignments
   - Changed ternary (? true : false) to !! operator in MemoryStep.tsx
   - More idiomatic TypeScript

5. Add 'openrouter' to EMBEDDING_PROVIDERS array
   - Added OpenRouter option to onboarding UI
   - Ensures detected provider is available in dropdown

6. Validate detected provider before applying
   - Added isValidProvider check before setting config
   - Prevents invalid providers from being applied

Signed-off-by: Frederic Thomas <[email protected]>
@doublefx
Copy link
Author

doublefx commented Jan 2, 2026

Code Review Issues Addressed ✅

All issues from code review have been resolved in commit dc6fad8:

Issue #1: Provider Type Mismatch

Fixed in: settings.ts:322

Added 'openrouter' to BackendEmbeddingProvider type to match GraphitiEmbeddingProvider:

export type BackendEmbeddingProvider = 'openai' | 'voyage' | 'google' | 'azure_openai' | 'ollama' | 'openrouter';

Issue #2: Complex Switch Statement

Fixed in: settings-handlers.ts:534-547

Simplified mapEmbeddingProvider function with array-based validation:

Before:

switch (envValue.toLowerCase().trim()) {
  case 'openai': return 'openai';
  case 'voyage': return 'voyage';
  // ... many more cases
}

After:

const mapEmbeddingProvider = (envValue: string | undefined): BackendEmbeddingProvider => {
  if (!envValue) return 'openai';
  const normalized = envValue.toLowerCase().trim() as BackendEmbeddingProvider;
  const validProviders: BackendEmbeddingProvider[] = ['openai', 'voyage', 'google', 'azure_openai', 'ollama', 'openrouter'];
  return validProviders.includes(normalized) ? normalized : 'openai';
};

Issue #3: Missing Error Logging

Fixed in: settings-handlers.ts:593

Added error logging in catch block:

} catch (error) {
  console.error('[Settings] Failed to get backend env embedding config:', error);
  return { success: false, error: 'Failed to check backend embedding config' };
}

Issue #4: Boolean Assignment Simplification

Fixed in: MemoryStep.tsx:107

Replaced ternary operator with !! operator:

Before:

setKuzuAvailable(infraResult?.success && infraResult?.data?.memory?.kuzuInstalled ? true : false);

After:

setKuzuAvailable(!!(infraResult?.success && infraResult?.data?.memory?.kuzuInstalled));

Issue #5: Missing 'openrouter' in UI

Fixed in: MemoryStep.tsx:44

Added OpenRouter to EMBEDDING_PROVIDERS array:

{ id: 'openrouter', name: 'OpenRouter', description: 'Multi-provider API', requiresApiKey: true },

Issue #6: Missing Provider Validation

Fixed in: MemoryStep.tsx:114-115

Added validation before applying detected provider:

const detectedProvider = envConfigResult.data.embeddingProvider;
// Validate that the detected provider is supported
const isValidProvider = EMBEDDING_PROVIDERS.some(p => p.id === detectedProvider);
if (detectedProvider && isValidProvider) {
  setConfig(prev => ({
    ...prev,
    embeddingProvider: detectedProvider
  }));
}

Note: Issue about using dotenv library for parsing is deferred for future consideration, as the current implementation works correctly and adding the library would introduce an additional dependency.

Commit: dc6fad8

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx (1)

122-124: Add error logging to catch block.

The catch block silently swallows errors from the parallel initialization checks. While the fallback behavior (setting kuzuAvailable to false) is acceptable, logging helps with debugging if the backend env config fetch or infrastructure check fails.

🔎 Suggested fix
       } catch (error) {
+        console.error('[MemoryStep] Failed to initialize memory config:', error);
         setKuzuAvailable(false);
       } finally {
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd6b46d and 1e7c164.

📒 Files selected for processing (5)
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/shared/types/settings.ts
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/types/settings.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/types/settings.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/shared/constants/ipc.ts
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
  • apps/frontend/src/shared/types/settings.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
🧠 Learnings (2)
📚 Learning: 2025-12-30T16:38:36.314Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Applies to apps/backend/.env* : Enable Electron MCP for E2E testing by setting `ELECTRON_MCP_ENABLED=true` in `.env` and starting the Electron app with `npm run dev`

Applied to files:

  • apps/frontend/src/shared/types/ipc.ts
  • apps/frontend/src/main/ipc-handlers/settings-handlers.ts
📚 Learning: 2025-12-30T16:38:36.314Z
Learnt from: CR
Repo: AndyMik90/Auto-Claude PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-30T16:38:36.314Z
Learning: Applies to apps/backend/integrations/graphiti/**/*.py : Use the Graphiti-provided multi-provider support for LLMs (OpenAI, Anthropic, Azure OpenAI, Ollama, Google AI) via `integrations/graphiti/graphiti_providers.py`

Applied to files:

  • apps/frontend/src/shared/types/settings.ts
🧬 Code graph analysis (2)
apps/frontend/src/shared/types/ipc.ts (1)
apps/frontend/src/shared/types/settings.ts (1)
  • BackendEnvEmbeddingConfig (324-331)
apps/frontend/src/main/ipc-handlers/settings-handlers.ts (3)
apps/frontend/src/main/ipc-handlers/context/utils.ts (1)
  • parseEnvFile (38-61)
apps/frontend/src/shared/types/settings.ts (2)
  • BackendEmbeddingProvider (322-322)
  • BackendEnvEmbeddingConfig (324-331)
apps/frontend/src/main/updater/path-resolver.ts (1)
  • getEffectiveSourcePath (57-89)
🔇 Additional comments (6)
apps/frontend/src/shared/types/ipc.ts (1)

62-62: LGTM! Type definitions are consistent.

The import and API signature for getBackendEnvEmbeddingConfig are correctly typed and aligned with the new BackendEnvEmbeddingConfig type defined in settings.ts.

Also applies to: 591-592

apps/frontend/src/shared/types/settings.ts (1)

320-331: LGTM! Type definitions are complete.

The BackendEmbeddingProvider type now includes all supported providers including 'openrouter', and the BackendEnvEmbeddingConfig interface is well-documented and appropriately structured.

apps/frontend/src/shared/constants/ipc.ts (1)

409-410: LGTM! IPC channel constant follows conventions.

The new BACKEND_ENV_GET_EMBEDDING_CONFIG channel is properly defined and documented.

apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx (1)

96-121: LGTM! Parallel initialization with proper validation.

The parallel execution of infrastructure check and backend env config fetch is efficient, and the provider validation against EMBEDDING_PROVIDERS ensures only supported providers are applied. The use of !! for boolean conversion is correct.

apps/frontend/src/main/ipc-handlers/settings-handlers.ts (2)

538-548: LGTM! Clean provider mapping implementation.

The simplified array-based validation with normalization is much more maintainable than the previous switch statement approach. Defaulting to 'openai' aligns with the backend .env.example documentation.


550-600: LGTM! Robust error handling with proper defaults.

The handler correctly:

  • Returns defaults when source path or .env is unavailable
  • Logs errors with console.error for debugging
  • Provides graceful fallback to 'openai' provider
  • Includes sourcePath and envExists metadata for UI display

@MikeeBuilds MikeeBuilds added feature New feature or request area/backend This is backend only labels Jan 2, 2026
doublefx added a commit to doublefx/Auto-Claude that referenced this pull request Jan 3, 2026
- Add openrouterApiKey field to MemoryConfig interface
- Initialize OpenRouter API key from settings
- Add validation for OpenRouter provider
- Add UI rendering for OpenRouter API key input
- Save OpenRouter API key to global settings
- Fixes CodeRabbit review comment about incomplete OpenRouter provider

Related to PR AndyMik90#571
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx (2)

44-44: OpenRouter provider entry looks good.

The OpenRouter provider is correctly added to EMBEDDING_PROVIDERS with requiresApiKey: true. The hardcoded strings for name and description are consistent with the existing providers in this array; converting all providers to i18n keys should be done in a separate refactor for consistency.


125-127: Add error logging in catch block.

The catch block silently swallows errors from the Promise.all call. While the fallback behavior is acceptable, logging the error aids debugging when either API call fails.

🔎 Proposed fix
-      } catch {
+      } catch (error) {
+        console.error('[MemoryStep] Failed to initialize memory config:', error);
         setKuzuAvailable(false);
       } finally {
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e7c164 and 8e5bf58.

📒 Files selected for processing (1)
  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
🧰 Additional context used
📓 Path-based instructions (3)
apps/frontend/src/**/*.{ts,tsx,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use i18n translation keys for all user-facing text in the frontend instead of hardcoded strings

Files:

  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
apps/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use useTranslation() hook with namespace prefixes (e.g., 'navigation:items.key') for accessing translation strings in React components

Files:

  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
apps/frontend/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/frontend/**/*.{ts,tsx}: Review React patterns and TypeScript type safety.
Check for proper state management and component composition.

Files:

  • apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx
🔇 Additional comments (5)
apps/frontend/src/renderer/components/onboarding/MemoryStep.tsx (5)

52-53: LGTM!

The openrouterApiKey field is correctly added to the MemoryConfig interface, following the existing pattern for other provider API keys.


79-92: LGTM!

The state initialization is well-structured:

  • Default embeddingProvider set to 'openai' with a clear comment explaining it will be updated from .env on mount.
  • openrouterApiKey correctly initialized from settings.globalOpenRouterApiKey following the same pattern as other API keys.

149-150: LGTM!

The OpenRouter API key validation is correctly added following the same pattern as other providers.


178-180: LGTM!

The OpenRouter API key is correctly persisted to settings with the same pattern used for other global API keys.


198-200: LGTM!

The local store update correctly includes globalOpenRouterApiKey, keeping it in sync with the saved settings.

@MikeeBuilds MikeeBuilds added the size/M Medium (100-499 lines) label Jan 3, 2026
doublefx and others added 5 commits January 3, 2026 12:43
Add IPC handler to read GRAPHITI_EMBEDDER_PROVIDER from backend .env file
and use it as the default in the Memory Step of the setup wizard.

Changes:
- Add BACKEND_ENV_GET_EMBEDDING_CONFIG IPC channel
- Add BackendEnvEmbeddingConfig type for IPC communication
- Add settings-handlers.ts handler to read backend .env
- Update MemoryStep.tsx to auto-detect provider on mount
- Change default provider from 'ollama' to 'openai' per .env.example docs

This ensures the Setup Wizard's memory configuration matches the backend's
configured embedding provider.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Addresses all feedback from code review:

1. Add 'openrouter' to BackendEmbeddingProvider type
   - Updated settings.ts to include 'openrouter' in union type
   - Matches GraphitiEmbeddingProvider type

2. Simplify mapEmbeddingProvider function
   - Replaced switch statement with array-based validation
   - Cleaner, more maintainable code

3. Add error handling and logging
   - Added console.error in catch block for getBackendEnvEmbeddingConfig
   - Improves debugging when .env file read fails

4. Simplify boolean assignments
   - Changed ternary (? true : false) to !! operator in MemoryStep.tsx
   - More idiomatic TypeScript

5. Add 'openrouter' to EMBEDDING_PROVIDERS array
   - Added OpenRouter option to onboarding UI
   - Ensures detected provider is available in dropdown

6. Validate detected provider before applying
   - Added isValidProvider check before setting config
   - Prevents invalid providers from being applied

Signed-off-by: Frederic Thomas <[email protected]>
- Add openrouterApiKey field to MemoryConfig interface
- Initialize OpenRouter API key from settings
- Add validation for OpenRouter provider
- Add UI rendering for OpenRouter API key input
- Save OpenRouter API key to global settings
- Fixes CodeRabbit review comment about incomplete OpenRouter provider

Related to PR AndyMik90#571
- Add OpenRouter to embedding provider dropdown in SecuritySettings.tsx
- Add OpenRouter credential fields with password toggle
- Add openrouterKeyIsGlobal type to ProjectEnvConfig
- Update MemoryBackendSection.tsx for consistency (unused component)

Fixes missing OpenRouter configuration in Settings page while it was already available in Setup Wizard.
Resolved conflicts:
- settings-handlers.ts: Kept getEffectiveSourcePath import (still used on line 557)
- MemoryStep.tsx: Kept globalOpenRouterApiKey additions for OpenRouter support
@doublefx doublefx force-pushed the feat/auto-detect-embedding-provider branch from 8e5bf58 to 1c390c3 Compare January 3, 2026 13:57
Copy link
Author

@doublefx doublefx left a comment

Choose a reason for hiding this comment

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

Response to i18n Suggestion

I agree with CodeRabbit's assessment that i18n should be used for user-facing text. However, as the review correctly points out:

"Since all other providers in this file also use hardcoded strings, this should be addressed consistently in a separate refactor."

Why I'm not fixing this in this PR:

  1. Consistency: All 6 embedding providers in EMBEDDING_PROVIDERS array use hardcoded strings (name, description)
  2. Scope creep: Converting only OpenRouter to i18n while leaving the other 5 providers hardcoded would create inconsistency
  3. Better as separate work: A dedicated PR to add i18n support for all embedding providers would be more appropriate and easier to review

Proposed follow-up:

  • Create a separate issue/PR to add i18n keys for all embedding provider strings
  • This would include: provider names, descriptions, API key labels, and help text
  • Estimated scope: ~6 providers × 3-4 strings each = comprehensive i18n refactor

For now, I'm following the established pattern in the file to maintain consistency. The OpenRouter implementation is functionally complete and matches the existing code style.

Does this reasoning make sense?

@doublefx
Copy link
Author

doublefx commented Jan 3, 2026

OpenRouter Provider Support - Implementation Summary

This PR now includes complete OpenRouter support across both the Setup Wizard and Settings page, addressing the unresolved CodeRabbit conversation.

What was added:

1. Setup Wizard (MemoryStep.tsx) - Commit 1e0521f

  • ✅ Added OpenRouter to EMBEDDING_PROVIDERS array
  • ✅ API key input with show/hide toggle
  • ✅ Validation requiring API key for OpenRouter
  • ✅ Save to global settings (globalOpenRouterApiKey)
  • ✅ Link to OpenRouter key management

2. Settings → Memory Page (SecuritySettings.tsx) - Commit cc4669d

  • ✅ Added OpenRouter to embedding provider dropdown
  • ✅ OpenRouter credential fields with password toggle
  • Global key detection: Shows when using global key from App Settings
  • Override support: Project-specific key can override global key
  • ✅ Visual indicator with Globe icon when using global key

3. Type Definitions (project.ts)

  • ✅ Added openrouterKeyIsGlobal?: boolean to ProjectEnvConfig
  • ✅ OpenRouter already existed in GraphitiEmbeddingProvider union type

4. Consistency (MemoryBackendSection.tsx)

  • ✅ Updated unused component for future use
  • ℹ️ This component is part of refactoring effort but not actively rendered

Why this matters:

Before this PR:

  • ❌ OpenRouter was in backend .env.example but missing from frontend UI
  • ❌ Users couldn't configure OpenRouter through the app

After this PR:

  • ✅ Complete UI support in Setup Wizard
  • ✅ Complete UI support in Settings → Memory
  • ✅ Auto-detection from backend .env (original PR feature)
  • ✅ Global key with project override support

Testing performed:

  1. ✅ Setup Wizard shows OpenRouter provider with API key input
  2. ✅ Settings → Memory page shows OpenRouter in dropdown
  3. ✅ Global key detection works (shows "Using global key" indicator)
  4. ✅ Project-specific override works (can enter key to override global)
  5. ✅ Build succeeds without errors

This implementation follows the exact same patterns used for OpenAI, Voyage, and other providers, ensuring consistency across the codebase.

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

Labels

area/backend This is backend only feature New feature or request size/M Medium (100-499 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants