Skip to content

Conversation

@yujonglee
Copy link
Contributor

No description provided.

Add a dedicated list-anthropic implementation to handle Anthropic's models endpoint and required headers. Anthropic requires the anthropic-version header and returns a different JSON shape, so extracting this logic into apps/desktop/src/components/settings/ai/shared/list-anthropic.ts prevents console errors and ensures proper model parsing, filtering, and timeout handling. The previous Anthropic handling in list-openai.ts was removed and imports updated to use the new module.
ㅍ
@netlify
Copy link

netlify bot commented Nov 19, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit 4efedca
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/691d73619e57890008a6e082
😎 Deploy Preview https://deploy-preview-1732--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Nov 19, 2025

📝 Walkthrough

Walkthrough

Refactors Anthropic model listing logic from a consolidated module into a dedicated file, updates HTTP fetching to use Tauri's HTTP plugin with improved error handling, and reorganizes imports to reflect the separation of concerns.

Changes

Cohort / File(s) Summary
Anthropic model listing extraction
apps/desktop/src/components/settings/ai/shared/list-anthropic.ts, apps/desktop/src/components/settings/ai/shared/list-openai.ts, apps/desktop/src/components/settings/ai/llm/select.tsx
New dedicated module for Anthropic model fetching with schema validation; function removed from consolidated list-openai module; imports reorganized in select component to reference new module
HTTP fetch implementation update
apps/desktop/src/components/settings/ai/shared/list-common.ts
Replaced native fetch with tauriFetch from Tauri HTTP plugin; enhanced error handling to include response body in error messages

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–25 minutes

  • Anthropic schema validation: Review the AnthropicModelSchema structure and partition logic to ensure it correctly validates and processes the API response.
  • Tauri HTTP integration: Verify tauriFetch behaves equivalently to native fetch, particularly around header handling (x-api-key, anthropic-version, anthropic-dangerous-direct-browser-access) and error propagation.
  • Import consistency: Confirm all import paths are correctly updated across files and that PROVIDERS is properly exposed in select.tsx.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to evaluate whether any description exists that relates to the changeset. Add a pull request description explaining the motivation, implementation details, or benefits of moving Anthropic model listing to a dedicated handler.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: extracting Anthropic model listing logic into a dedicated handler module, which is the primary refactoring across all modified files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-anthropic-list-handler

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.

Copy link

@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: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b63b838 and 4efedca.

📒 Files selected for processing (4)
  • apps/desktop/src/components/settings/ai/llm/select.tsx (1 hunks)
  • apps/desktop/src/components/settings/ai/shared/list-anthropic.ts (1 hunks)
  • apps/desktop/src/components/settings/ai/shared/list-common.ts (2 hunks)
  • apps/desktop/src/components/settings/ai/shared/list-openai.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • apps/desktop/src/components/settings/ai/shared/list-openai.ts
🧰 Additional context used
🧬 Code graph analysis (1)
apps/desktop/src/components/settings/ai/shared/list-anthropic.ts (1)
apps/desktop/src/components/settings/ai/shared/list-common.ts (7)
  • ListModelsResult (14-17)
  • DEFAULT_RESULT (19-19)
  • fetchJson (34-45)
  • partition (52-68)
  • ModelIgnoreReason (4-10)
  • shouldIgnoreCommonKeywords (47-50)
  • REQUEST_TIMEOUT (20-20)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: fmt
  • GitHub Check: ci (macos, macos-14)
🔇 Additional comments (8)
apps/desktop/src/components/settings/ai/shared/list-common.ts (2)

1-1: LGTM: Tauri HTTP plugin is the correct choice for desktop apps.

Using tauriFetch from @tauri-apps/plugin-http instead of native fetch is appropriate for Tauri desktop applications, as it avoids CORS restrictions and permission issues that can occur with browser-based fetch in desktop contexts.


36-44: LGTM: Enhanced error handling with better debugging context.

The changes improve error handling by:

  • Including the response body in error messages for better debugging
  • Preserving the original error object instead of wrapping it, which maintains stack traces and error types
apps/desktop/src/components/settings/ai/llm/select.tsx (2)

17-26: LGTM: Clean import reorganization reflecting modular structure.

The updated imports properly reflect the separation of Anthropic model listing into its own dedicated module, improving modularity and maintainability.


228-230: LGTM: Consistent usage of the new Anthropic model listing function.

The function call properly uses the newly imported listAnthropicModels with the expected parameters.

apps/desktop/src/components/settings/ai/shared/list-anthropic.ts (4)

1-11: LGTM: Appropriate imports for Effect-based async flow.

The imports properly bring in Effect utilities for functional composition and shared helpers from list-common.


31-33: LGTM: Appropriate guard clause for invalid base URL.

The early return prevents unnecessary API calls when the base URL is not configured.


42-54: LGTM: Proper model filtering and partitioning logic.

The implementation correctly:

  • Decodes the response using the schema
  • Filters models based on common keywords
  • Partitions results into accepted and ignored models
  • Extracts the model ID as the key

55-58: LGTM: Appropriate timeout and error handling.

The timeout and fallback to DEFAULT_RESULT on any error ensure the function doesn't hang and provides graceful degradation.

@yujonglee yujonglee merged commit f6c6ea2 into main Nov 19, 2025
15 checks passed
@yujonglee yujonglee deleted the add-anthropic-list-handler branch November 19, 2025 10:47
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