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

Function validateModelsAndKeysProvided

webview-ui/src/utils/validate.ts:40–148  ·  view source on GitHub ↗
(
	apiConfiguration: ProviderSettings,
	zooCodeIsAuthenticated?: boolean,
)

Source from the content-addressed store, hash-verified

38}
39
40function validateModelsAndKeysProvided(
41 apiConfiguration: ProviderSettings,
42 zooCodeIsAuthenticated?: boolean,
43): string | undefined {
44 switch (apiConfiguration.apiProvider) {
45 case "openrouter":
46 if (!apiConfiguration.openRouterApiKey) {
47 return i18next.t("settings:validation.apiKey")
48 }
49 break
50 case "requesty":
51 if (!apiConfiguration.requestyApiKey) {
52 return i18next.t("settings:validation.apiKey")
53 }
54 break
55 case "unbound":
56 if (!apiConfiguration.unboundApiKey) {
57 return i18next.t("settings:validation.apiKey")
58 }
59 break
60 case "litellm":
61 if (!apiConfiguration.litellmApiKey) {
62 return i18next.t("settings:validation.apiKey")
63 }
64 break
65 case "anthropic":
66 if (!apiConfiguration.apiKey) {
67 return i18next.t("settings:validation.apiKey")
68 }
69 break
70 case "bedrock":
71 if (!apiConfiguration.awsRegion) {
72 return i18next.t("settings:validation.awsRegion")
73 }
74 break
75 case "vertex":
76 if (!apiConfiguration.vertexProjectId || !apiConfiguration.vertexRegion) {
77 return i18next.t("settings:validation.googleCloud")
78 }
79 break
80 case "gemini":
81 if (!apiConfiguration.geminiApiKey) {
82 return i18next.t("settings:validation.apiKey")
83 }
84 break
85 case "openai-native":
86 if (!apiConfiguration.openAiNativeApiKey) {
87 return i18next.t("settings:validation.apiKey")
88 }
89 break
90 case "mistral":
91 if (!apiConfiguration.mistralApiKey) {
92 return i18next.t("settings:validation.apiKey")
93 }
94 break
95 case "openai":
96 if (!apiConfiguration.openAiBaseUrl || !apiConfiguration.openAiApiKey || !apiConfiguration.openAiModelId) {
97 return i18next.t("settings:validation.openAi")

Calls

no outgoing calls

Tested by

no test coverage detected