90
const AUTO_MODEL_ID = 'auto';
91
92
>
function compareModelVersions(a: string | undefined, b: string | undefined): number {
modelSelection.ts
93
>
const rawA = a ?? '';
94
>
const rawB = b ?? '';
95
>
const segmentsA = rawA.match(/\d+/g)?.map(Number) ?? [];
96
>
const segmentsB = rawB.match(/\d+/g)?.map(Number) ?? [];
97
>
const length = Math.max(segmentsA.length, segmentsB.length);
98
>
for (let index = 0; index < length; index++) {
99
>
const numberA = segmentsA[index] ?? 0;
100
>
const numberB = segmentsB[index] ?? 0;
101
>
if (numberA !== numberB) {
102
>
return numberA - numberB;
103
>
}
104
>
}
105
return rawA.localeCompare(rawB);
106
}