Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/screens/ModelsScreen/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export function getModelType(model: ModelInfo): ModelTypeFilter {
export function isPhiModel(modelName: string, modelId: string): boolean {
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);
Comment on lines 72 to +75

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
  1. 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.

}

export function getTextModelCompatibility(
Expand Down
2 changes: 1 addition & 1 deletion src/stores/appStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const DEFAULT_SETTINGS: AppSettings = {
cacheType: 'q8_0' as CacheType,
showGenerationDetails: false,
enabledTools: ['web_search', 'calculator', 'get_current_datetime', 'get_device_info', 'read_url', 'search_knowledge_base'],
thinkingEnabled: true,
thinkingEnabled: false,
};

function migrateEnabledTools(merged: any): void {
Expand Down
Loading