Fixed ibm validation happening when api key is not present
This commit is contained in:
parent
2e7a4ceb4f
commit
2169df80f8
1 changed files with 262 additions and 262 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
import type { Dispatch, SetStateAction } from "react";
|
import type { Dispatch, SetStateAction } from "react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
import IBMLogo from "@/components/icons/ibm-logo";
|
||||||
import { LabelInput } from "@/components/label-input";
|
import { LabelInput } from "@/components/label-input";
|
||||||
import { LabelWrapper } from "@/components/label-wrapper";
|
import { LabelWrapper } from "@/components/label-wrapper";
|
||||||
import IBMLogo from "@/components/icons/ibm-logo";
|
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import {
|
import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
|
|
@ -39,14 +39,16 @@ export function IBMOnboarding({
|
||||||
hasEnvApiKey?: boolean;
|
hasEnvApiKey?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const [endpoint, setEndpoint] = useState(
|
const [endpoint, setEndpoint] = useState(
|
||||||
alreadyConfigured ? "" : (existingEndpoint || "https://us-south.ml.cloud.ibm.com"),
|
alreadyConfigured
|
||||||
|
? ""
|
||||||
|
: existingEndpoint || "https://us-south.ml.cloud.ibm.com",
|
||||||
);
|
);
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [getFromEnv, setGetFromEnv] = useState(
|
const [getFromEnv, setGetFromEnv] = useState(
|
||||||
hasEnvApiKey && !alreadyConfigured,
|
hasEnvApiKey && !alreadyConfigured,
|
||||||
);
|
);
|
||||||
const [projectId, setProjectId] = useState(
|
const [projectId, setProjectId] = useState(
|
||||||
alreadyConfigured ? "" : (existingProjectId || ""),
|
alreadyConfigured ? "" : existingProjectId || "",
|
||||||
);
|
);
|
||||||
|
|
||||||
const options = [
|
const options = [
|
||||||
|
|
@ -93,14 +95,12 @@ export function IBMOnboarding({
|
||||||
} = useGetIBMModelsQuery(
|
} = useGetIBMModelsQuery(
|
||||||
{
|
{
|
||||||
endpoint: debouncedEndpoint ? debouncedEndpoint : undefined,
|
endpoint: debouncedEndpoint ? debouncedEndpoint : undefined,
|
||||||
apiKey: getFromEnv ? "" : (debouncedApiKey ? debouncedApiKey : undefined),
|
apiKey: getFromEnv ? "" : debouncedApiKey ? debouncedApiKey : undefined,
|
||||||
projectId: debouncedProjectId ? debouncedProjectId : undefined,
|
projectId: debouncedProjectId ? debouncedProjectId : undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled:
|
enabled:
|
||||||
!!debouncedEndpoint ||
|
(!!debouncedEndpoint && !!debouncedApiKey && !!debouncedProjectId) ||
|
||||||
!!debouncedApiKey ||
|
|
||||||
!!debouncedProjectId ||
|
|
||||||
getFromEnv ||
|
getFromEnv ||
|
||||||
alreadyConfigured,
|
alreadyConfigured,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue