refactor(agents): dedupe model catalog entries · openclaw/openclaw@daf7c92
vincentkoc
·
2026-06-18
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,8 +6,10 @@
|
6 | 6 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
7 | 7 | import type { ModelCatalogEntry } from "./model-catalog.js"; |
8 | 8 | import { createProviderAuthChecker } from "./model-provider-auth.js"; |
9 | | -import { modelKey } from "./model-selection-normalize.js"; |
10 | | -import { buildConfiguredModelCatalog } from "./model-selection-shared.js"; |
| 9 | +import { |
| 10 | +buildConfiguredModelCatalog, |
| 11 | +dedupeModelCatalogEntries, |
| 12 | +} from "./model-selection-shared.js"; |
11 | 13 | import { |
12 | 14 | RUNTIME_MODEL_VISIBILITY_NORMALIZATION, |
13 | 15 | createModelVisibilityPolicy, |
@@ -77,22 +79,6 @@ function sortModelCatalogEntries(entries: ModelCatalogEntry[]): ModelCatalogEntr
|
77 | 79 | ); |
78 | 80 | } |
79 | 81 | |
80 | | -function dedupeModelCatalogEntries(entries: ModelCatalogEntry[]): ModelCatalogEntry[] { |
81 | | -// Preserve the first occurrence after precedence merging while removing |
82 | | -// provider/id duplicates from configured and auth-backed catalogs. |
83 | | -const seen = new Set<string>(); |
84 | | -const next: ModelCatalogEntry[] = []; |
85 | | -for (const entry of entries) { |
86 | | -const key = modelKey(entry.provider, entry.id); |
87 | | -if (seen.has(key)) { |
88 | | -continue; |
89 | | -} |
90 | | -seen.add(key); |
91 | | -next.push(entry); |
92 | | -} |
93 | | -return next; |
94 | | -} |
95 | | - |
96 | 82 | /** |
97 | 83 | * Resolve catalog entries visible for one view, honoring explicit visibility |
98 | 84 | * policy, configured models, and providers with usable auth. |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。