feat(ai): device-aware Ollama recommendation + one-click pull#198
Conversation
PR E of the 1.24.0 hardening sequence. Turns the static Ollama hint into a
"recommended for your device" chip with a real one-click install, plus
battery-aware model sizing.
- services/ollamaService.ts: pullOllamaModel(name, {baseUrl, signal, onProgress})
— POST /api/pull, streams NDJSON progress (status + byte fraction), surfaces
Ollama's in-band {error} lines as thrown errors, propagates AbortError unchanged
for cancel, and reports unreachable-server / non-200 distinctly.
- services/ai/modelRecommendations.ts: getOllamaModelForDevice(report) — curated
tiered catalog (high-end qwen2.5:7b / mid-range llama3.2:3b / low-end llama3.2:1b)
driven by the profiler's deviceClass; steps down one tier on low battery
(battery/perf hardening) and flags the downgrade.
- components/settings/OllamaDevicePull.tsx: recommendation chip (reuses the PR B
Badge) + Pull button with live progress bar, cancel, error+retry, and
"use this model"; wired into the Ollama provider block in AiSections.
- i18n: 10 ollamaPull.* keys (5 core translated, Beta/RTL EN-fallback) + bundles.
- Tests: pullOllamaModel (progress/abort/error/non-200/empty-name, 8),
getOllamaModelForDevice (tier + battery downgrade, 6), OllamaDevicePull (5).
- Tauri CSP already allows localhost:11434 — no change needed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…eta locales
CodeAnt wave-1 on PR E:
- ollamaService.pullOllamaModel: wrap the read loop in try/finally and cancel the
reader in finally, so an inline {error} throw (or any parse error) can't leave the
HTTP body streaming in the background (resource leak).
- AiSections "use this model": recommended tags aren't in the known-options list, so
applying one takes the custom-model path — sync setCustomModelInput so the selector
isn't left showing a stale custom value.
- i18n: replace the English-fallback ollamaPull.* values with proper translations
across all 12 Beta/RTL locales (el/ja/pt/zh/fi/sv/hu/is/eu/ar/he/fa) + bundles.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@CodeAnt-AI review |
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis PR adds a settings panel flow that selects an Ollama model based on the user's device profile, lets the user pull it from their local Ollama server with live progress, and then apply it as the active AI model in one click. sequenceDiagram
participant User
participant SettingsUI
participant ModelRecommender
participant OllamaService
participant OllamaServer
participant SettingsStore
User->>SettingsUI: Open advanced AI settings with Ollama provider
SettingsUI->>ModelRecommender: Request device-aware Ollama model
ModelRecommender-->>SettingsUI: Recommended model, tier and battery note
User->>SettingsUI: Click Pull model
SettingsUI->>OllamaService: Start pullOllamaModel with base URL and callbacks
OllamaService->>OllamaServer: Call pull API and stream progress
OllamaServer-->>OllamaService: Status events and final success
OllamaService-->>SettingsUI: Progress updates and installed state
User->>SettingsUI: Click Use this model
SettingsUI->>SettingsStore: Save selected Ollama model for provider
Generated by CodeAnt AI |
CodeAnt wave-2: the abort test asserted queryByRole('alert') === null immediately
after the click, which is trivially true before the async pull settles (false
positive). Use a deferred pull promise to first confirm the in-flight state (Cancel
button visible), then reject with AbortError and wait (findBy) for the idle Pull
button to return with no alert — a real post-abort transition.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@CodeAnt-AI review |
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis PR adds a device- and battery-aware Ollama model recommendation in the settings UI and wires it to a one-click pull flow that streams progress from the local Ollama server and applies the model as the active selection. sequenceDiagram
participant User
participant SettingsUI
participant DeviceProfiler
participant RecommendationService
participant OllamaServer
User->>SettingsUI: Open advanced AI settings with Ollama provider
SettingsUI->>DeviceProfiler: getHealthReport
DeviceProfiler-->>RecommendationService: Device report
RecommendationService-->>SettingsUI: Recommended model and tier (battery-aware)
User->>SettingsUI: Click pull recommended model
SettingsUI->>OllamaServer: POST pull model and stream progress
OllamaServer-->>SettingsUI: NDJSON status and progress until success
User->>SettingsUI: Click use this model
SettingsUI->>SettingsUI: Set active Ollama model to recommended tag
Generated by CodeAnt AI |
…test CodeAnt wave-3: the abort test manually rejected the mocked pull instead of clicking Cancel, so broken cancel wiring (onClick not aborting the controller) could slip through. The mock now observes the AbortSignal and rejects only when it fires; the test clicks the real Cancel button (onClick → abortRef.abort() → signal) and waits for the idle Pull button to return — broken wiring would hang in the pulling state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@CodeAnt-AI review |
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis PR adds a settings flow that profiles the device, selects a battery-aware Ollama model, and lets the user pull and activate that model with streamed progress, cancel, and retry handling. sequenceDiagram
participant User
participant SettingsUI
participant DeviceProfiler
participant RecommendationService
participant OllamaAPI
participant SettingsStore
SettingsUI->>DeviceProfiler: Request device health
DeviceProfiler-->>SettingsUI: Device report
SettingsUI->>RecommendationService: Get Ollama model for device
RecommendationService-->>SettingsUI: Recommended model and tier
User->>SettingsUI: Click pull recommended model
SettingsUI->>OllamaAPI: Pull model with progress stream
OllamaAPI-->>SettingsUI: Progress updates and final status
alt Pull success
SettingsUI->>SettingsStore: Save recommended Ollama model as active
SettingsStore-->>User: Model installed and ready to use
else Pull error
SettingsUI-->>User: Show error and retry option
end
Generated by CodeAnt AI |
CodeAnt wave-4 (race): startPull had no in-flight guard and its finally cleared abortRef unconditionally, so a late-resolving stale pull could null a newer pull's controller and break Cancel. Add an early `if (abortRef.current) return;` guard and only clear the ref in finally when it still points to this controller. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@CodeAnt-AI review |
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis diagram shows how the settings UI profiles the device to pick a recommended Ollama model, streams a one-click pull from the local Ollama server with progress, and then applies the pulled model as the active AI setting. sequenceDiagram
participant User
participant SettingsUI
participant DeviceAdvisor
participant OllamaServer
participant SettingsStore
SettingsUI->>DeviceAdvisor: Get recommended Ollama model for device
DeviceAdvisor-->>SettingsUI: Recommended model and tier (battery-aware)
User->>SettingsUI: Click Pull model
SettingsUI->>OllamaServer: Request pull for recommended model (streamed)
OllamaServer-->>SettingsUI: Progress updates and final success
SettingsUI-->>User: Show pull progress and installed state
User->>SettingsUI: Click Use this model
SettingsUI->>SettingsStore: Save selected Ollama model as active setting
Generated by CodeAnt AI |
User description
Summary
PR E of the Critical & Immediate hardening sequence. Turns the static Ollama model hint into a "recommended for your device" chip with a real one-click install, plus battery-aware sizing.
Changes
pullOllamaModel(name, {baseUrl, signal, onProgress})(services/ollamaService.ts) —POST /api/pull, streams NDJSON progress (status + byte fraction). Surfaces Ollama's in-band{error}lines as thrown errors, propagates AbortError unchanged for cancel, and reports unreachable-server / non-200 distinctly.getOllamaModelForDevice(report)(services/ai/modelRecommendations.ts) — curated tiered catalog (high-endqwen2.5:7b/ mid-rangellama3.2:3b/ low-endllama3.2:1b) driven by the profiler'sdeviceClass. Steps down one tier on low battery (battery/perf hardening) and flags the downgrade.OllamaDevicePull(components/settings/) — recommendation chip (reuses PR B's Badge) + Pull button with live progress bar, cancel, error+retry, and "use this model"; wired into the Ollama provider block inAiSections.ollamaPull.*keys (5 core translated; Beta/RTL EN-fallback) + bundles.pullOllamaModel(progress/abort/inline-error/non-200/empty-name — 8),getOllamaModelForDevice(tier + battery downgrade — 6),OllamaDevicePull(render/pull-success/error-retry/abort/battery — 5).localhost:11434/127.0.0.1:11434— no change needed.Verification
check-suppressions(52) ·lint·typecheck(exit 0) ·i18n:check(17 locales / 2776 keys) green.gemini).🤖 Generated with Claude Code
CodeAnt-AI Description
Show a device-based Ollama recommendation and let users install it in one step
What Changed
Impact
✅ Faster model setup✅ Fewer failed Ollama installs✅ Clearer device-fit recommendations💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.