fix(settings): disable thinking by default and fix phi model detection#355
fix(settings): disable thinking by default and fix phi model detection#355dishit-wednesday wants to merge 1 commit into
Conversation
- Flip thinkingEnabled default to false for new installs; existing users unaffected via persisted store - Fix isPhiModel regex to use word-boundary + digit pattern so dolphin models are no longer incorrectly blocked as Phi models
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
There was a problem hiding this comment.
Code Review
This pull request updates the isPhiModel utility to use a more precise regular expression for identifying Phi models, preventing false positives like 'dolphin'. It also sets the default value of thinkingEnabled to false in the app settings. Feedback was provided to remove redundant toLowerCase() calls in the isPhiModel function, as the new regular expression already handles case-insensitivity.
| const name = modelName.toLowerCase(); | ||
| const id = modelId.toLowerCase(); | ||
| return name.includes('phi') || id.includes('phi'); | ||
| const phiPattern = /\bphi[-_]?\d/i; | ||
| return phiPattern.test(name) || phiPattern.test(id); |
There was a problem hiding this comment.
The toLowerCase() calls are redundant because the regular expression already uses the case-insensitive flag (/i). Removing these calls avoids unnecessary string allocations and simplifies the function. Additionally, the new regex correctly fixes the issue where models like 'dolphin' were being incorrectly blocked because they contained the substring 'phi' (as in 'dol-phi-n'). Note that since modelId is guaranteed to be set in this context, no additional existence guards are required.
| const name = modelName.toLowerCase(); | |
| const id = modelId.toLowerCase(); | |
| return name.includes('phi') || id.includes('phi'); | |
| const phiPattern = /\bphi[-_]?\d/i; | |
| return phiPattern.test(name) || phiPattern.test(id); | |
| const phiPattern = /\bphi[-_]?\d/i; | |
| return phiPattern.test(modelName) || phiPattern.test(modelId); |
References
- Do not add redundant validation guards for fields in DownloadEntry (such as modelId) as these are guaranteed to be set and validated during the creation of the entry.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
==========================================
- Coverage 83.07% 83.06% -0.01%
==========================================
Files 231 231
Lines 11930 11931 +1
Branches 3272 3272
==========================================
Hits 9911 9911
Misses 1166 1166
- Partials 853 854 +1
🚀 New features to boost your workflow:
|



Summary
dolphin-mistral,dolphin-llamaetc.) were incorrectly blocked because'dolphin'.includes('phi')istrue. Replaced with/\bphi[-_]?\d/iso only actual Phi variants (phi-3, phi3, phi-4) are matchedImpact