Make model generation deterministic by sorting providers and models

This commit is contained in:
Duncan Ogilvie 2025-12-27 13:55:41 +01:00
parent 04fa79ebe0
commit bf6da8c72f
2 changed files with 6385 additions and 6381 deletions

View file

@ -662,11 +662,15 @@ import type { Model } from "./types.js";
export const MODELS = {
`;
// Generate provider sections
for (const [providerId, models] of Object.entries(providers)) {
// Generate provider sections (sorted for deterministic output)
const sortedProviderIds = Object.keys(providers).sort();
for (const providerId of sortedProviderIds) {
const models = providers[providerId];
output += `\t${JSON.stringify(providerId)}: {\n`;
for (const model of Object.values(models)) {
const sortedModelIds = Object.keys(models).sort();
for (const modelId of sortedModelIds) {
const model = models[modelId];
output += `\t\t"${model.id}": {\n`;
output += `\t\t\tid: "${model.id}",\n`;
output += `\t\t\tname: "${model.name}",\n`;

File diff suppressed because it is too large Load diff