Feat: Improve Model Tier Recommendation for Apple Silicon#1299
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR adds Apple Silicon detection to backend hardware tiering and exposes the chip name; the frontend shows the detected Apple Silicon name in the onboarding hardware summary, falling back to GPU names or 'No dedicated GPU'. ChangesApple Silicon Detection Integration
Sequence Diagram(s)sequenceDiagram
participant Frontend
participant Backend
participant HardwareDetect
participant Sysctl
Frontend->>Backend: GET /api/hardware (onboarding)
Backend->>HardwareDetect: detect_hardware_tier()
HardwareDetect->>HardwareDetect: detect_apple_silicon_tier()
HardwareDetect->>Sysctl: sysctl -n machdep.cpu.brand_string
Sysctl-->>HardwareDetect: "Apple M3 Pro" (or fallback)
HardwareDetect-->>Backend: tier + apple_silicon
Backend-->>Frontend: 200 { hardware info including apple_silicon }
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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: 2
🤖 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 `@backend/app/utils/hardware_detect.py`:
- Around line 1-6: This module uses PEP 604 union syntax (e.g., annotations like
"str | None") but lacks the compatibility import; add "from __future__ import
annotations" as the very first line of backend/app/utils/hardware_detect.py
(before any other imports such as shutil, subprocess, platform, onnxruntime or
psutil) so functions and type hints in this file (e.g., any that use "|" unions)
work on Python 3.9.
- Around line 68-81: The function detect_apple_silicon_tier currently returns
"medium" by default for any Apple Silicon not matched as base M1/M2 small, which
contradicts issue `#1292`; update detect_apple_silicon_tier (using the chip
variable from detect_apple_silicon()) so that the final/default return is
"small" instead of "medium" while keeping existing logic that explicitly
classifies Pro/Max/Ultra as non-small.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 74b81545-d40a-4ea0-9ee8-f3535db5b6fd
📒 Files selected for processing (3)
backend/app/utils/hardware_detect.pyfrontend/src/components/OnboardingSteps/AIModelSetupStep.tsxfrontend/src/types/models.ts
|
How'd lint fail for a file that wasn't even touched?! 🤔 |
Closes #1292
This pull request adds improved detection and reporting of Apple Silicon hardware in both the backend and frontend. The main changes include new utility functions to detect Apple Silicon and its performance tier, updating the hardware info API to include this data, and adjusting the frontend to display Apple Silicon chip names when present.
Apple Silicon Detection and Tiering:
detect_apple_silicon()anddetect_apple_silicon_tier()functions to identify Apple Silicon chips and classify them as "small" (base M1/M2) or "medium" (Pro/Max/Ultra, M3+, or future chips) inhardware_detect.py.detect_hardware_tier()to return the Apple Silicon tier if detected, improving model recommendations for Mac users.Backend API Enhancements:
get_hardware_info()to include anapple_siliconfield in the returned dictionary, exposing chip information to the frontend.Frontend and Type Updates:
HardwareInfoTypeScript interface to include the newapple_siliconfield.AIModelSetupStep.tsxto show the Apple Silicon chip name (if present) instead of GPU info, improving clarity for Mac users.Screenshots/Recordings:
AI Usage Disclosure:
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.
Check one of the checkboxes below:
I have used the following AI models and tools: Claude, Gemini
Checklist
Summary by CodeRabbit