


























@@ -10,7 +10,11 @@ import {
1010} from "../agents/agent-scope.js";
1111import { lookupContextTokens, resolveContextTokensForModel } from "../agents/context.js";
1212import { DEFAULT_CONTEXT_TOKENS, DEFAULT_MODEL, DEFAULT_PROVIDER } from "../agents/defaults.js";
13-import { findModelInCatalog, type ModelCatalogEntry } from "../agents/model-catalog.js";
13+import {
14+findModelCatalogEntry,
15+modelSupportsInput,
16+type ModelCatalogEntry,
17+} from "../agents/model-catalog.js";
1418import {
1519inferUniqueProviderFromConfiguredModels,
1620normalizeStoredOverrideModel,
@@ -68,8 +72,8 @@ import {
6872} from "../shared/avatar-policy.js";
6973import {
7074normalizeLowercaseStringOrEmpty,
71-normalizeOptionalLowercaseString,
7275normalizeOptionalString,
76+normalizeOptionalLowercaseString,
7377} from "../shared/string-coerce.js";
7478import { normalizeSessionDeliveryFields } from "../utils/delivery-context.shared.js";
7579import { estimateUsageCost, resolveModelCostConfig } from "../utils/usage-format.js";
@@ -1115,23 +1119,6 @@ export function resolveSessionModelRef(
11151119return resolved;
11161120}
111711211118-function findGatewayImageSupportCatalogEntry(params: {
1119-catalog: ModelCatalogEntry[];
1120-provider?: string;
1121-model: string;
1122-}): ModelCatalogEntry | undefined {
1123-const provider = normalizeOptionalString(params.provider);
1124-if (provider) {
1125-return findModelInCatalog(params.catalog, provider, params.model);
1126-}
1127-1128-const normalizedModel = normalizeLowercaseStringOrEmpty(params.model);
1129-const matches = params.catalog.filter(
1130-(entry) => normalizeLowercaseStringOrEmpty(entry.id) === normalizedModel,
1131-);
1132-return matches.length === 1 ? matches[0] : undefined;
1133-}
1134-11351122export async function resolveGatewayModelSupportsImages(params: {
11361123loadGatewayModelCatalog: () => Promise<ModelCatalogEntry[]>;
11371124provider?: string;
@@ -1143,10 +1130,9 @@ export async function resolveGatewayModelSupportsImages(params: {
1143113011441131try {
11451132const catalog = await params.loadGatewayModelCatalog();
1146-const modelEntry = findGatewayImageSupportCatalogEntry({
1147- catalog,
1133+const modelEntry = findModelCatalogEntry(catalog, {
11481134provider: params.provider,
1149-model: params.model,
1135+modelId: params.model,
11501136});
11511137const normalizedProvider = normalizeOptionalLowercaseString(
11521138params.provider ?? modelEntry?.provider,
@@ -1156,7 +1142,7 @@ export async function resolveGatewayModelSupportsImages(params: {
11561142normalizeLowercaseStringOrEmpty(modelEntry?.name),
11571143].filter(Boolean);
11581144if (modelEntry) {
1159-if (modelEntry.input?.includes("image")) {
1145+if (modelSupportsInput(modelEntry, "image")) {
11601146return true;
11611147}
11621148// Legacy safety shim for stale persisted Foundry rows that predate
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。