mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:17:42 +00:00
fix(models): refresh Moonshot Kimi vision capabilities
Co-authored-by: manikv12 <mac1317@live.missouristate.edu>
This commit is contained in:
@@ -29,22 +29,41 @@ 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 implicitById = new Map(
|
||||
implicitModels.map((model) => [getId(model), model] as const).filter(([id]) => Boolean(id)),
|
||||
);
|
||||
const seen = new Set<string>();
|
||||
|
||||
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;
|
||||
}),
|
||||
];
|
||||
const mergedModels = explicitModels.map((explicitModel) => {
|
||||
const id = getId(explicitModel);
|
||||
if (!id) {
|
||||
return explicitModel;
|
||||
}
|
||||
seen.add(id);
|
||||
const implicitModel = implicitById.get(id);
|
||||
if (!implicitModel) {
|
||||
return explicitModel;
|
||||
}
|
||||
|
||||
// Refresh capability metadata from the implicit catalog while preserving
|
||||
// user-specific fields (cost, headers, compat, etc.) on explicit entries.
|
||||
return {
|
||||
...explicitModel,
|
||||
input: implicitModel.input,
|
||||
reasoning: implicitModel.reasoning,
|
||||
contextWindow: implicitModel.contextWindow,
|
||||
maxTokens: implicitModel.maxTokens,
|
||||
};
|
||||
});
|
||||
|
||||
for (const implicitModel of implicitModels) {
|
||||
const id = getId(implicitModel);
|
||||
if (!id || seen.has(id)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(id);
|
||||
mergedModels.push(implicitModel);
|
||||
}
|
||||
|
||||
return {
|
||||
...implicit,
|
||||
|
||||
Reference in New Issue
Block a user