MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getModelValidationError

Function getModelValidationError

webview-ui/src/utils/validate.ts:267–288  ·  view source on GitHub ↗
(
	apiConfiguration: ProviderSettings,
	routerModels?: RouterModels,
	organizationAllowList?: OrganizationAllowList,
)

Source from the content-addressed store, hash-verified

265 * This is used to show model errors specifically in the model selector components.
266 */
267export function getModelValidationError(
268 apiConfiguration: ProviderSettings,
269 routerModels?: RouterModels,
270 organizationAllowList?: OrganizationAllowList,
271): string | undefined {
272 const modelId = isProviderName(apiConfiguration.apiProvider)
273 ? getModelIdForProvider(apiConfiguration, apiConfiguration.apiProvider)
274 : apiConfiguration.apiModelId
275
276 const configWithModelId = {
277 ...apiConfiguration,
278 apiModelId: modelId || "",
279 }
280
281 const orgError = validateProviderAgainstOrganizationSettings(configWithModelId, organizationAllowList)
282
283 if (orgError && orgError.code === "MODEL_NOT_ALLOWED") {
284 return orgError.message
285 }
286
287 return validateDynamicProviderModelId(configWithModelId, routerModels)
288}
289
290/**
291 * Validates API configuration but excludes model-specific errors.

Callers 2

ApiOptionsFunction · 0.90
validate.spec.tsFile · 0.90

Tested by

no test coverage detected