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

Function validateApiConfiguration

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

Source from the content-addressed store, hash-verified

14} from "@roo-code/types"
15
16export function validateApiConfiguration(
17 apiConfiguration: ProviderSettings,
18 routerModels?: RouterModels,
19 organizationAllowList?: OrganizationAllowList,
20 zooCodeIsAuthenticated?: boolean,
21): string | undefined {
22 const keysAndIdsPresentErrorMessage = validateModelsAndKeysProvided(apiConfiguration, zooCodeIsAuthenticated)
23
24 if (keysAndIdsPresentErrorMessage) {
25 return keysAndIdsPresentErrorMessage
26 }
27
28 const organizationAllowListError = validateProviderAgainstOrganizationSettings(
29 apiConfiguration,
30 organizationAllowList,
31 )
32
33 if (organizationAllowListError) {
34 return organizationAllowListError.message
35 }
36
37 return validateDynamicProviderModelId(apiConfiguration, routerModels)
38}
39
40function validateModelsAndKeysProvided(
41 apiConfiguration: ProviderSettings,

Callers 3

WelcomeViewProviderFunction · 0.90
validate.spec.tsFile · 0.90

Tested by

no test coverage detected