This commit is contained in:
Manik Vahsith 2026-01-30 07:48:27 -06:00 committed by GitHub
commit 2cacbd6070
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 34 additions and 13 deletions

View File

@ -288,7 +288,7 @@ function buildMoonshotProvider(): ProviderConfig {
id: MOONSHOT_DEFAULT_MODEL_ID,
name: "Kimi K2.5",
reasoning: false,
input: ["text"],
input: ["text", "image"],
cost: MOONSHOT_DEFAULT_COST,
contextWindow: MOONSHOT_DEFAULT_CONTEXT_WINDOW,
maxTokens: MOONSHOT_DEFAULT_MAX_TOKENS,

View File

@ -29,18 +29,39 @@ function mergeProviderModels(implicit: ProviderConfig, explicit: ProviderConfig)
const id = (model as { id?: unknown }).id;
return typeof id === "string" ? id.trim() : "";
};
const seen = new Set(explicitModels.map(getId).filter(Boolean));
const mergedModels = [
...explicitModels,
...implicitModels.filter((model) => {
const id = getId(model);
if (!id) return false;
if (seen.has(id)) return false;
seen.add(id);
return true;
}),
];
// Build a lookup of implicit (code-defined) models by ID so we can
// refresh stale config-written definitions with up-to-date capability
// fields (input, reasoning, contextWindow, maxTokens) while preserving
// any user-specific overrides (cost, headers, compat).
const implicitById = new Map(
implicitModels.map((m) => [getId(m), m] as const).filter(([id]) => id),
);
const seen = new Set<string>();
const mergedModels = explicitModels.map((explicitModel) => {
const id = getId(explicitModel);
if (id) seen.add(id);
const implicitModel = id ? implicitById.get(id) : undefined;
if (!implicitModel) return explicitModel;
// Merge: code-defined capability fields override stale config values,
// while user-specific fields (cost, headers, compat) are preserved.
return {
...explicitModel,
input: implicitModel.input,
reasoning: implicitModel.reasoning,
contextWindow: implicitModel.contextWindow,
maxTokens: implicitModel.maxTokens,
};
});
// Append implicit models whose IDs are not present in the explicit list.
for (const model of implicitModels) {
const id = getId(model);
if (!id || seen.has(id)) continue;
seen.add(id);
mergedModels.push(model);
}
return {
...implicit,

View File

@ -103,7 +103,7 @@ export const SYNTHETIC_MODEL_CATALOG = [
id: "hf:moonshotai/Kimi-K2.5",
name: "Kimi K2.5",
reasoning: true,
input: ["text"],
input: ["text", "image"],
contextWindow: 256000,
maxTokens: 8192,
},