-
- }
- size={"xs"}
- onClick={() => setNewCustomProvider(null)}
- onKeyDown={(e) => {
- if (e.key === "Enter" || e.key === " ") {
- setNewCustomProvider(null);
- }
- }}
- variant="outline"
- tabIndex={0}
- color={"grey"}
- border={"none"}
- p={0}
- fontSize={16}
- borderRadius={"50%"}
- _hover={{
- borderColor: "gray.400",
- color: "gray.400",
- }}
- _focus={{
- _focus: {
- outline: "none",
- boxShadow: "0 0 0 3px rgba(66, 153, 225, 0.6)",
- borderColor: "blue.300",
- },
- }}
- _active={{
- backgroundColor: "none",
- }}
- />
-
-
-
-
- {
- setNewCustomProvider(
- new CustomProvider(
- e.target.value,
- newCustomProvider.apiUrl,
- "",
- newCustomProvider.apiKey
- )
- );
- }}
- />
-
- Name is required.
-
-
-
-
-
- {
- setNewCustomProvider(
- new CustomProvider(
- newCustomProvider.name,
- e.target.value,
- "",
- newCustomProvider.apiKey
- )
- );
- }}
- />
-
- API URL is required.
-
-
-
-
- {
- setNewCustomProvider(
- new CustomProvider(
- newCustomProvider.name,
- newCustomProvider.apiUrl,
- "",
- e.target.value
- )
- );
- }}
- />
- API Key is required.
-
-
-
-
-
- Save
-
-
-
-
- )}
- {[...Object.values(tableProviders)] // copy of the array
- .reverse() // reverse the array so new provider is at top
- .map((provider) => {
- return (
-
-
-
- handleSelectedProviderChange(provider)}
- isChecked={selectedProvider?.name === provider.name}
- />
-
-
- {provider.name}
-
-
- {extractDomain(provider.apiUrl)}
-
-
-
- {provider.name === "Free AI Models" ? (
-
-
-
- ) : (
-
- handleApiKeyChange(provider, e.target.value)}
- onFocus={() => setFocusedProvider(provider)}
- isDisabled={provider instanceof FreeModelProvider}
- isInvalid={
- !!(
- !isValidating &&
- focusedProvider?.name === provider.name &&
- isApiKeyInvalid
- )
- }
- />
- {focusedProvider?.name === provider.name && isValidating ? (
-
-
-
- Validating...
- {" "}
-
- ) : (
-
- {provider.apiKey
- ? "Unable to verify key."
- : "API Key is required."}
-
- )}
- {provider instanceof OpenRouterProvider &&
- provider.name === focusedProvider?.name &&
- !provider.apiKey && (
-
- Get OpenRouter key{" "}
-
- )}
-
- )}
-
-
-
- {settings.currentProvider.name === provider.name && (
-
- )}
-
-
-
- );
- })}
-