MCPcopy Index your code
hub / github.com/simstudioai/sim / orderModelIdsByReleaseDate

Function orderModelIdsByReleaseDate

apps/sim/providers/models.ts:3207–3234  ·  view source on GitHub ↗
(modelIds: string[])

Source from the content-addressed store, hash-verified

3205 * dynamically-discovered provider models) are left in their original order at the end.
3206 */
3207export function orderModelIdsByReleaseDate(modelIds: string[]): string[] {
3208 const groups = new Map<string, string[]>()
3209 const unknown: string[] = []
3210
3211 for (const id of modelIds) {
3212 const meta = MODEL_CATALOG_INDEX.get(id.toLowerCase())
3213 if (!meta) {
3214 unknown.push(id)
3215 continue
3216 }
3217 const bucket = groups.get(meta.providerId)
3218 if (bucket) bucket.push(id)
3219 else groups.set(meta.providerId, [id])
3220 }
3221
3222 const ordered: string[] = []
3223 for (const bucket of groups.values()) {
3224 bucket.sort((a, b) => {
3225 const ma = MODEL_CATALOG_INDEX.get(a.toLowerCase())!
3226 const mb = MODEL_CATALOG_INDEX.get(b.toLowerCase())!
3227 if (ma.releaseTime !== mb.releaseTime) return mb.releaseTime - ma.releaseTime
3228 return ma.declIndex - mb.declIndex
3229 })
3230 ordered.push(...bucket)
3231 }
3232 ordered.push(...unknown)
3233 return ordered
3234}
3235
3236export const DYNAMIC_MODEL_PROVIDERS = [
3237 'ollama',

Callers 2

models.test.tsFile · 0.90
getModelOptionsFunction · 0.90

Calls 3

getMethod · 0.65
setMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected