()
| 148 | |
| 149 | /** Run all detectors in parallel; combine + sort results. */ |
| 150 | export async function detectAllLocalModels(): Promise<DetectedModel[]> { |
| 151 | const [ollama, lmStudio] = await Promise.all([ |
| 152 | detectOllamaModels(), |
| 153 | detectLMStudioModels(), |
| 154 | ]); |
| 155 | // Sort: native-tool-calling first, then larger models first within each tier. |
| 156 | // This is what humans actually want: "show me my best option first". |
| 157 | const all = [...ollama, ...lmStudio]; |
| 158 | all.sort((a, b) => { |
| 159 | const aTC = a.toolCallsLikely ? 1 : 0; |
| 160 | const bTC = b.toolCallsLikely ? 1 : 0; |
| 161 | if (aTC !== bTC) return bTC - aTC; |
| 162 | return (b.paramsB ?? 0) - (a.paramsB ?? 0); |
| 163 | }); |
| 164 | return all; |
| 165 | } |
| 166 | |
| 167 | /** Try to extract parameter count in billions from a model id. */ |
| 168 | function parseParamsFromId(id: string): number | undefined { |
no test coverage detected