Repository navigation
fix(ai): support /v1-in-base endpoints, dedupe providers, model searc… - #106
Conversation
…h + favorites - llm: don't strip a mid-path /v1; new buildApiUrl only appends /v1 when the base has no version segment, so gateways like .../v1/openai resolve correctly. Route all chat/models/key fetch sites through it. - providers: dedupe savedProviders by id on add/edit/delete + hydration (self-heals doubled entries / duplicate React keys); disable switch/add/edit/ delete while a provider form is open. - model picker: add a search box and per-model favorites (global, persisted); favorites sort to the top. Star toggles without selecting/closing the menu.
|
Warning Review limit reached
Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe changes centralize OpenAI-compatible endpoint construction, remove duplicate saved providers, restrict provider controls during editing, and add globally persisted model search and favorites across model pickers. ChangesAI endpoint construction
Saved provider normalization
Model picker search and favorites
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@electron/lib/llm.ts`:
- Around line 30-40: Update buildApiUrl to separate any query string or fragment
from baseUrl before appending cleanPath, then append the preserved suffix after
the resulting endpoint path. Ensure both query-only and fragment-containing base
URLs produce the correct path, and add coverage for both forms.
In `@src/store/slices/ui.ts`:
- Line 20: Run npm run type-check:all and resolve every TypeScript error related
to FAVORITE_MODELS_KEY and its imports/usages. Update src/store/slices/ui.ts
(20-20), src/store/slices/ui.test.ts (3-3), and
src/components/settings/ProviderManager.tsx (9-9) so the symbol’s declaration
and references use consistent, valid types and imports; verify the command
passes cleanly.
- Around line 155-159: Move the saved-provider normalization around rawProviders
and dedupeProviders before the window.electron?.secrets availability check in
the hydration flow. Ensure duplicate providers set changed and are persisted
even when the secrets bridge is unavailable, while preserving the existing
secrets-dependent behavior afterward.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: de073b2d-f0e0-43b1-88a9-c89e7fb659e3
📒 Files selected for processing (17)
changelogs/v2.5.18.mdelectron/ipc/ai-handlers.tselectron/ipc/tool-builder.tselectron/lib/bench-endpoint.tselectron/lib/chat-loop.tselectron/lib/chat-quality-scorer.test.tselectron/lib/chat-subagent-loop.tselectron/lib/compaction.tselectron/lib/llm-url.test.tselectron/lib/llm.tselectron/lib/pi-agent-loop.tssrc/components/settings/ProviderManager.tsxsrc/components/ui/dropdown.tsxsrc/components/ui/model-picker.tsxsrc/store/index.tssrc/store/slices/ui.test.tssrc/store/slices/ui.ts
|
|
||
| export const HIDDEN_VIEWS_KEY = "hiddenViews"; | ||
| export const SEEN_FEATURES_KEY = "seenFeatures"; | ||
| export const FAVORITE_MODELS_KEY = "favoriteModels"; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
npm run type-check:allRepository: ddutchie/cairn
Length of output: 1362
Ensure a clean npm run type-check:all passes.
The type-check command exits now, and the TypeScript files require npm run type-check:all to pass before these changes can land.
📍 Affects 3 files
src/store/slices/ui.ts#L20-L20(this comment)src/store/slices/ui.test.ts#L3-L3src/components/settings/ProviderManager.tsx#L9-L9
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/store/slices/ui.ts` at line 20, Run npm run type-check:all and resolve
every TypeScript error related to FAVORITE_MODELS_KEY and its imports/usages.
Update src/store/slices/ui.ts (20-20), src/store/slices/ui.test.ts (3-3), and
src/components/settings/ProviderManager.tsx (9-9) so the symbol’s declaration
and references use consistent, valid types and imports; verify the command
passes cleanly.
Source: Coding guidelines
…ore secrets guard - buildApiUrl: peel off any ?query/#fragment before appending the API path and re-append it after, so bases like ".../v1?token=x" resolve correctly. Add coverage for query-only and fragment-containing bases. - migrateLlmKeysToKeychain: run saved-provider dedup before the secrets-bridge availability check so a doubled list self-heals (and is persisted) even on web / no-secrets builds; key-migration behavior after the guard is unchanged.
What does this PR do?
Type of change
Screenshots / recording
Checklist
npm run type-check:allpassesnpm run lintpassesnpm testpasses (runsnpm run compilefirst soelectron/bundle-guard.test.tsactually executes —npm run test:bundleto run just that)npm run test:e2epasses (run before merging UI changes or cutting a release)scripts/features.config.jsso it appears in the "What's New" modal (generated JSON — runnode scripts/generate-features.js)var(--accent),var(--text-primary), etc.)text-[Npx]pixel font classes — rem equivalents only (text-[0.714rem],text-xs, etc.)handle()and returnIpcResult<T>schema.tselectron/db/queries.ts— single source of truth (imported by both Electron main process and MCP server); never construct aDatabaseinstance outsidedb/client.ts(Electron) ormcp-server.ts(MCP runtime)dependenciesordevDependenciesadded toROLE_MAPinscripts/generate-licenses.jsandlicenses.jsonregeneratedelectron/mcp/tools/index.tsdispatch +electron/lib/tool-schemas.tsZod schema--external:<pkg>flag in thecompilescript: updated the appropriate allowlist group (RUNTIME_PROVIDED/OPTIONAL_TRANSITIVE/SUBPROCESS_ONLY/SHIPPED_NATIVE) inelectron/bundle-guard.test.tsand (ifSHIPPED_NATIVE) shipped the package viaelectron-builder.ymlNotes for reviewer
Quick Follow Up to Last PR
Summary by CodeRabbit
New Features
Bug Fixes