* Match a model name to a known profile using fuzzy prefix matching. * @param {string} modelName - The model name from config (e.g. "huihui-gemma-4-e4b-it-abliterated") * @returns {object|null} Profile or null if no match
(modelName)
| 96 | * @returns {object|null} Profile or null if no match |
| 97 | */ |
| 98 | function matchProfile(modelName) { |
| 99 | const name = modelName.toLowerCase(); |
| 100 | |
| 101 | // Try exact key matches first (longest match wins) |
| 102 | const keys = Object.keys(KNOWN_PROFILES).sort((a, b) => b.length - a.length); |
| 103 | for (const key of keys) { |
| 104 | if (name.includes(key)) { |
| 105 | return { ...KNOWN_PROFILES[key], matched_key: key }; |
| 106 | } |
| 107 | } |
| 108 | return null; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Get the effective profile for a model, with defaults for unknowns. |