From dc502885051e5425a3f94c058be7e3341ac79cc8 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Mon, 9 Sep 2024 08:59:53 -0700 Subject: [PATCH 1/8] clean interfaces + improve dex experience --- backend/danswer/configs/app_configs.py | 2 +- .../docker_compose/docker-compose.dev.yml | 2 +- .../docker_compose/docker-compose.gpu-dev.yml | 2 +- .../docker-compose.search-testing.yml | 2 +- .../llm/CustomLLMProviderUpdateForm.tsx | 56 +- .../llm/LLMProviderUpdateForm.tsx | 112 +-- .../[connector]/AddConnectorPage.tsx | 768 ++++++------------ .../connectors/[connector]/NavigationRow.tsx | 91 +++ .../connectors/[connector]/pages/Advanced.tsx | 95 +-- .../pages/ConnectorInput/NumberInput.tsx | 15 - .../pages/ConnectorInput/SelectInput.tsx | 37 +- .../pages/DynamicConnectorCreationForm.tsx | 31 +- .../[connector]/pages/utils/files.ts | 2 - .../[connector]/pages/utils/google_site.ts | 11 +- .../admin/embeddings/RerankingFormPage.tsx | 11 +- web/src/app/admin/embeddings/interfaces.ts | 19 +- .../modals/ProviderCreationModal.tsx | 9 +- .../pages/AdvancedEmbeddingFormPage.tsx | 241 ++---- .../embeddings/pages/EmbeddingFormPage.tsx | 14 +- .../ee/admin/groups/UserGroupCreationForm.tsx | 2 +- web/src/components/admin/connectors/Field.tsx | 28 +- .../admin/connectors/FileUpload.tsx | 7 + .../credentials/actions/CreateCredential.tsx | 4 +- .../credentials/actions/EditCredential.tsx | 58 +- .../components/embedding/CustomModelForm.tsx | 11 +- web/src/lib/connectors/connectors.ts | 64 ++ 26 files changed, 693 insertions(+), 1001 deletions(-) create mode 100644 web/src/app/admin/connectors/[connector]/NavigationRow.tsx diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index d7733fdc0ab..f53daf3a68e 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -134,7 +134,7 @@ os.environ.get("POSTGRES_PASSWORD") or "password" ) POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost" -POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432" +POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433" POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres" # defaults to False diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index eb5ba5efc88..deef76ada17 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -287,7 +287,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432:5432" + - "5433:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.gpu-dev.yml b/deployment/docker_compose/docker-compose.gpu-dev.yml index 74da119737e..c2e2991e103 100644 --- a/deployment/docker_compose/docker-compose.gpu-dev.yml +++ b/deployment/docker_compose/docker-compose.gpu-dev.yml @@ -295,7 +295,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432:5432" + - "5433:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.search-testing.yml b/deployment/docker_compose/docker-compose.search-testing.yml index ecd796f6716..c477e85512d 100644 --- a/deployment/docker_compose/docker-compose.search-testing.yml +++ b/deployment/docker_compose/docker-compose.search-testing.yml @@ -153,7 +153,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432" + - "5433" volumes: - db_volume:/var/lib/postgresql/data diff --git a/web/src/app/admin/configuration/llm/CustomLLMProviderUpdateForm.tsx b/web/src/app/admin/configuration/llm/CustomLLMProviderUpdateForm.tsx index 204d054a991..6a9c0756cb9 100644 --- a/web/src/app/admin/configuration/llm/CustomLLMProviderUpdateForm.tsx +++ b/web/src/app/admin/configuration/llm/CustomLLMProviderUpdateForm.tsx @@ -28,6 +28,7 @@ import { PopupSpec } from "@/components/admin/connectors/Popup"; import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled"; import * as Yup from "yup"; import isEqual from "lodash/isEqual"; +import { IsPublicGroupSelector } from "@/components/IsPublicGroupSelector"; function customConfigProcessing(customConfigsList: [string, string][]) { const customConfig: { [key: string]: string } = {}; @@ -209,7 +210,7 @@ export function CustomLLMProviderUpdateForm({ setSubmitting(false); }} > - {({ values, setFieldValue }) => { + {(formikProps) => { return (
) => (
- {values.custom_config_list.map((_, index) => { + {formikProps.values.custom_config_list.map((_, index) => { return (
List the individual models that you want to make available as @@ -431,49 +432,12 @@ export function CustomLLMProviderUpdateForm({ subtext="If set, this LLM Provider will be available to all users. If not, only the specified User Groups will be able to use it." /> - {userGroups && - userGroups.length > 0 && - !values.is_public && ( -
- - Select which User Groups should have access to this - LLM Provider. - -
- {userGroups.map((userGroup) => { - const isSelected = values.groups.includes( - userGroup.id - ); - return ( - { - if (isSelected) { - setFieldValue( - "groups", - values.groups.filter( - (id) => id !== userGroup.id - ) - ); - } else { - setFieldValue("groups", [ - ...values.groups, - userGroup.id, - ]); - } - }} - > -
- -
{userGroup.name}
-
-
- ); - })} -
-
- )} + )} diff --git a/web/src/app/admin/configuration/llm/LLMProviderUpdateForm.tsx b/web/src/app/admin/configuration/llm/LLMProviderUpdateForm.tsx index 677fa4bd929..7e66b715c8b 100644 --- a/web/src/app/admin/configuration/llm/LLMProviderUpdateForm.tsx +++ b/web/src/app/admin/configuration/llm/LLMProviderUpdateForm.tsx @@ -24,6 +24,7 @@ import { PopupSpec } from "@/components/admin/connectors/Popup"; import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled"; import * as Yup from "yup"; import isEqual from "lodash/isEqual"; +import { IsPublicGroupSelector } from "@/components/IsPublicGroupSelector"; export function LLMProviderUpdateForm({ llmProviderDescriptor, @@ -96,20 +97,20 @@ export function LLMProviderUpdateForm({ : Yup.string(), ...(llmProviderDescriptor.custom_config_keys ? { - custom_config: Yup.object( - llmProviderDescriptor.custom_config_keys.reduce( - (acc, customConfigKey) => { - if (customConfigKey.is_required) { - acc[customConfigKey.name] = Yup.string().required( - `${customConfigKey.name} is required` - ); - } - return acc; - }, - {} as { [key: string]: Yup.StringSchema } - ) - ), - } + custom_config: Yup.object( + llmProviderDescriptor.custom_config_keys.reduce( + (acc, customConfigKey) => { + if (customConfigKey.is_required) { + acc[customConfigKey.name] = Yup.string().required( + `${customConfigKey.name} is required` + ); + } + return acc; + }, + {} as { [key: string]: Yup.StringSchema } + ) + ), + } : {}), default_model_name: Yup.string().required("Model name is required"), fast_default_model_name: Yup.string().nullable(), @@ -219,8 +220,10 @@ export function LLMProviderUpdateForm({ setSubmitting(false); }} > - {({ values, setFieldValue }) => ( + {(formikProps) => ( + + {!hideAdvanced && ( 0 && (
({ - value: name, - label: getDisplayNameForModel(name), - }) - )} + options={llmProviderDescriptor.llm_names.map((name) => ({ + value: name, + label: getDisplayNameForModel(name), + }))} onChange={(selected) => - setFieldValue("display_model_names", selected) + formikProps.setFieldValue("display_model_names", selected) } />
)} - {isPaidEnterpriseFeaturesEnabled && userGroups && ( - <> - - - {userGroups && - userGroups.length > 0 && - !values.is_public && ( -
- - Select which User Groups should have access to - this LLM Provider. - -
- {userGroups.map((userGroup) => { - const isSelected = values.groups.includes( - userGroup.id - ); - return ( - { - if (isSelected) { - setFieldValue( - "groups", - values.groups.filter( - (id) => id !== userGroup.id - ) - ); - } else { - setFieldValue("groups", [ - ...values.groups, - userGroup.id, - ]); - } - }} - > -
- -
- {userGroup.name} -
-
-
- ); - })} -
-
- )} - - )} + )} @@ -482,6 +431,7 @@ export function LLMProviderUpdateForm({
)} + ); } diff --git a/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx b/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx index 895abf95d1a..b008a54aae8 100644 --- a/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx +++ b/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx @@ -1,19 +1,17 @@ "use client"; -import * as Yup from "yup"; -import { TrashIcon } from "@/components/icons/icons"; import { errorHandlingFetcher } from "@/lib/fetcher"; import useSWR, { mutate } from "swr"; import { HealthCheckBanner } from "@/components/health/healthcheck"; -import { Card, Divider, Title } from "@tremor/react"; +import { Card, Title } from "@tremor/react"; import { AdminPageTitle } from "@/components/admin/Title"; import { buildSimilarCredentialInfoURL } from "@/app/admin/connector/[ccPairId]/lib"; import { usePopup } from "@/components/admin/connectors/Popup"; import { useFormContext } from "@/components/context/FormContext"; import { getSourceDisplayName } from "@/lib/sources"; import { SourceIcon } from "@/components/SourceIcon"; -import { useRef, useState, useEffect } from "react"; +import { useState } from "react"; import { submitConnector } from "@/components/admin/connectors/ConnectorForm"; import { deleteCredential, linkCredential } from "@/lib/credential"; import { submitFiles } from "./pages/utils/files"; @@ -27,38 +25,38 @@ import { Credential, credentialTemplates } from "@/lib/connectors/credentials"; import { ConnectionConfiguration, connectorConfigs, + createConnectorInitialValues, + createConnectorValidationSchema, } from "@/lib/connectors/connectors"; import { Modal } from "@/components/Modal"; -import { ArrowRight } from "@phosphor-icons/react"; -import { ArrowLeft } from "@phosphor-icons/react/dist/ssr"; -import { FiPlus } from "react-icons/fi"; import GDriveMain from "./pages/gdrive/GoogleDrivePage"; import { GmailMain } from "./pages/gmail/GmailPage"; import { useGmailCredentials, useGoogleDriveCredentials, } from "./pages/utils/hooks"; -import { Formik, FormikProps } from "formik"; -import { - IsPublicGroupSelector, - IsPublicGroupSelectorFormType, -} from "@/components/IsPublicGroupSelector"; -import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled"; - -export type AdvancedConfigFinal = { - pruneFreq: number | null; - refreshFreq: number | null; - indexingStart: Date | null; -}; +import { Formik } from "formik"; +import { IsPublicGroupSelector } from "@/components/IsPublicGroupSelector"; +import NavigationRow from "./NavigationRow"; + +export interface AdvancedConfig { + refreshFreq: number; + pruneFreq: number; + indexingStart: string; +} export default function AddConnector({ connector, }: { connector: ConfigurableSources; }) { + // State for managing credentials and files const [currentCredential, setCurrentCredential] = useState | null>(null); + const [selectedFiles, setSelectedFiles] = useState([]); + const [createConnectorToggle, setCreateConnectorToggle] = useState(false); + // Fetch credentials data const { data: credentials } = useSWR[]>( buildSimilarCredentialInfoURL(connector), errorHandlingFetcher, @@ -70,76 +68,27 @@ export default function AddConnector({ errorHandlingFetcher, { refreshInterval: 5000 } ); - const [selectedFiles, setSelectedFiles] = useState([]); + // Get credential template and configuration const credentialTemplate = credentialTemplates[connector]; - - const { - setFormStep, - setAllowAdvanced, - setAlowCreate, - formStep, - nextFormStep, - prevFormStep, - } = useFormContext(); - - const { popup, setPopup } = usePopup(); - const configuration: ConnectionConfiguration = connectorConfigs[connector]; - const [formValues, setFormValues] = useState< - Record & IsPublicGroupSelectorFormType - >({ - name: "", - groups: [], - is_public: true, - ...configuration.values.reduce( - (acc, field) => { - if (field.type === "select") { - acc[field.name] = null; - } else if (field.type === "list") { - acc[field.name] = field.default || []; - } else if (field.type === "checkbox") { - acc[field.name] = field.default || false; - } else if (field.default !== undefined) { - acc[field.name] = field.default; - } - return acc; - }, - {} as { [record: string]: any } - ), - }); - - const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled(); - - // Default to 10 minutes unless otherwise specified - const defaultAdvancedSettings = { - refreshFreq: formValues.overrideDefaultFreq || 10, - pruneFreq: 30, - indexingStart: null as string | null, - }; - - const [advancedSettings, setAdvancedSettings] = useState( - defaultAdvancedSettings - ); - - const [createConnectorToggle, setCreateConnectorToggle] = useState(false); - const formRef = useRef>(null); - - const [isFormValid, setIsFormValid] = useState(false); - const handleFormStatusChange = (isValid: boolean) => { - setIsFormValid(isValid || connector == "file"); - }; + // Form context and popup management + const { setFormStep, setAlowCreate, formStep, nextFormStep, prevFormStep } = + useFormContext(); + const { popup, setPopup } = usePopup(); + // Hooks for Google Drive and Gmail credentials const { liveGDriveCredential } = useGoogleDriveCredentials(); - const { liveGmailCredential } = useGmailCredentials(); + // Check if credential is activated const credentialActivated = (connector === "google_drive" && liveGDriveCredential) || (connector === "gmail" && liveGmailCredential) || currentCredential; + // Check if there are no credentials const noCredentials = credentialTemplate == null; if (noCredentials && 1 != formStep) { @@ -150,164 +99,20 @@ export default function AddConnector({ setFormStep(Math.min(formStep, 0)); } - const resetAdvancedConfigs = (formikProps: FormikProps) => { - formikProps.resetForm({ values: defaultAdvancedSettings }); - setAdvancedSettings(defaultAdvancedSettings); - }; - const convertStringToDateTime = (indexingStart: string | null) => { return indexingStart ? new Date(indexingStart) : null; }; - const createConnector = async () => { - const { - name, - groups, - is_public: isPublic, - ...connector_specific_config - } = formValues; - const { pruneFreq, indexingStart, refreshFreq } = advancedSettings; - - // Apply transforms from connectors.ts configuration - const transformedConnectorSpecificConfig = Object.entries( - connector_specific_config - ).reduce( - (acc, [key, value]) => { - const matchingConfigValue = configuration.values.find( - (configValue) => configValue.name === key - ); - if ( - matchingConfigValue && - "transform" in matchingConfigValue && - matchingConfigValue.transform - ) { - acc[key] = matchingConfigValue.transform(value as string[]); - } else { - acc[key] = value; - } - return acc; - }, - {} as Record - ); - - const AdvancedConfig: AdvancedConfigFinal = { - pruneFreq: advancedSettings.pruneFreq * 60 * 60 * 24, - indexingStart: convertStringToDateTime(indexingStart), - refreshFreq: advancedSettings.refreshFreq * 60, - }; - - // google sites-specific handling - if (connector == "google_sites") { - const response = await submitGoogleSite( - selectedFiles, - formValues?.base_url, - setPopup, - AdvancedConfig, - name - ); - if (response) { - setTimeout(() => { - window.open("/admin/indexing/status", "_self"); - }, 1000); - } - return; - } - - // file-specific handling - if (connector == "file" && selectedFiles.length > 0) { - const response = await submitFiles( - selectedFiles, - setPopup, - setSelectedFiles, - name, - AdvancedConfig, - isPublic, - groups - ); - if (response) { - setTimeout(() => { - window.open("/admin/indexing/status", "_self"); - }, 1000); - } - return; - } - - const { message, isSuccess, response } = await submitConnector( - { - connector_specific_config: transformedConnectorSpecificConfig, - input_type: connector == "web" ? "load_state" : "poll", // single case - name: name, - source: connector, - refresh_freq: refreshFreq * 60 || null, - prune_freq: pruneFreq * 60 * 60 * 24 || null, - indexing_start: convertStringToDateTime(indexingStart), - is_public: isPublic, - groups: groups, - }, - undefined, - credentialActivated ? false : true, - isPublic - ); - // If no credential - if (!credentialActivated) { - if (isSuccess) { - setPopup({ - message: "Connector created! Redirecting to connector home page", - type: "success", - }); - setTimeout(() => { - window.open("/admin/indexing/status", "_self"); - }, 1000); - } else { - setPopup({ message: message, type: "error" }); - } - } - - // Without credential - if (credentialActivated && isSuccess && response) { - const credential = - currentCredential || liveGDriveCredential || liveGmailCredential; - const linkCredentialResponse = await linkCredential( - response.id, - credential?.id!, - name, - isPublic, - groups - ); - if (linkCredentialResponse.ok) { - setPopup({ - message: "Connector created! Redirecting to connector home page", - type: "success", - }); - setTimeout(() => { - window.open("/admin/indexing/status", "_self"); - }, 1000); - } else { - const errorData = await linkCredentialResponse.json(); - setPopup({ - message: errorData.message, - type: "error", - }); - } - } else if (isSuccess) { - setPopup({ - message: - "Credential created succsfully! Redirecting to connector home page", - type: "success", - }); - } else { - setPopup({ message: message, type: "error" }); - } - }; - const displayName = getSourceDisplayName(connector) || connector; if (!credentials || !editableCredentials) { return <>; } + // Credential handler functions const refresh = () => { mutate(buildSimilarCredentialInfoURL(connector)); }; + const onDeleteCredential = async (credential: Credential) => { const response = await deleteCredential(credential.id, true); if (response.ok) { @@ -334,291 +139,258 @@ export default function AddConnector({ refresh(); }; - const validationSchema = Yup.object().shape({ - name: Yup.string().required("Connector Name is required"), - ...configuration.values.reduce( - (acc, field) => { - let schema: any = - field.type === "select" - ? Yup.string() - : field.type === "list" - ? Yup.array().of(Yup.string()) - : field.type === "checkbox" - ? Yup.boolean() - : Yup.string(); - - if (!field.optional) { - schema = schema.required(`${field.label} is required`); - } - acc[field.name] = schema; - return acc; - }, - {} as Record - ), - }); - - const advancedValidationSchema = Yup.object().shape({ - indexingStart: Yup.string().nullable(), - pruneFreq: Yup.number().min(0, "Prune frequency must be non-negative"), - refreshFreq: Yup.number().min(0, "Refresh frequency must be non-negative"), - }); - - const isFormSubmittable = (values: any) => { - return ( - values.name.trim() !== "" && - Object.keys(values).every((key) => { - const field = configuration.values.find((f) => f.name === key); - return field?.optional || values[key] !== ""; - }) - ); + const onSuccess = () => { + setPopup({ + message: "Connector created! Redirecting to connector home page", + type: "success", + }); + setTimeout(() => { + window.open("/admin/indexing/status", "_self"); + }, 1000); }; return ( -
- {popup} -
- -
- - } - title={displayName} - /> - - {formStep == 0 && - (connector == "google_drive" ? ( - <> - - Select a credential - - -
- -
- - ) : connector == "gmail" ? ( - <> - - Select a credential - - -
- -
- - ) : ( - <> - - Select a credential - - {!createConnectorToggle && ( - - )} - - {/* NOTE: connector will never be google_drive, since the ternary above will - prevent that, but still keeping this here for safety in case the above changes. */} - {(connector as ValidSources) !== "google_drive" && - createConnectorToggle && ( - setCreateConnectorToggle(false)} - > - <> - - Create a {getSourceDisplayName(connector)} credential - - setCreateConnectorToggle(false)} - /> - - - )} - -
- + { + console.log(" Iam submiing the connector"); + const { + name, + groups, + is_public: isPublic, + pruneFreq, + indexingStart, + refreshFreq, + ...connector_specific_config + } = values; + + // Apply transforms from connectors.ts configuration + const transformedConnectorSpecificConfig = Object.entries( + connector_specific_config + ).reduce( + (acc, [key, value]) => { + const matchingConfigValue = configuration.values.find( + (configValue) => configValue.name === key + ); + if ( + matchingConfigValue && + "transform" in matchingConfigValue && + matchingConfigValue.transform + ) { + acc[key] = matchingConfigValue.transform(value as string[]); + } else { + acc[key] = value; + } + return acc; + }, + {} as Record + ); + + // Apply advanced configuration-specific transforms. + const advancedConfiguration: any = { + pruneFreq: pruneFreq * 60 * 60 * 24, + indexingStart: convertStringToDateTime(indexingStart), + refreshFreq: refreshFreq * 60, + }; + + // Google sites-specific handling + if (connector == "google_sites") { + const response = await submitGoogleSite( + selectedFiles, + values?.base_url, + setPopup, + advancedConfiguration.refreshFreq, + advancedConfiguration.pruneFreq, + advancedConfiguration.indexingStart, + name + ); + if (response) { + onSuccess(); + } + return; + } + + // File-specific handling + if (connector == "file" && selectedFiles.length > 0) { + const response = await submitFiles( + selectedFiles, + setPopup, + setSelectedFiles, + name, + isPublic, + groups + ); + if (response) { + onSuccess(); + } + return; + } + + const { message, isSuccess, response } = await submitConnector( + { + connector_specific_config: transformedConnectorSpecificConfig, + input_type: connector == "web" ? "load_state" : "poll", // single case + name: name, + source: connector, + refresh_freq: advancedConfiguration.refreshFreq || null, + prune_freq: advancedConfiguration.pruneFreq || null, + indexing_start: advancedConfiguration.indexingStart || null, + is_public: isPublic, + groups: groups, + }, + undefined, + credentialActivated ? false : true, + isPublic + ); + // If no credential + if (!credentialActivated) { + if (isSuccess) { + onSuccess(); + } else { + setPopup({ message: message, type: "error" }); + } + } + + // Without credential + if (credentialActivated && isSuccess && response) { + const credential = + currentCredential || liveGDriveCredential || liveGmailCredential; + const linkCredentialResponse = await linkCredential( + response.id, + credential?.id!, + name, + isPublic, + groups + ); + if (linkCredentialResponse.ok) { + onSuccess(); + } else { + const errorData = await linkCredentialResponse.json(); + setPopup({ + message: errorData.message, + type: "error", + }); + } + } else if (isSuccess) { + onSuccess(); + } else { + setPopup({ message: message, type: "error" }); + } + return; + }} + > + {(formikProps) => { + return ( +
+ {popup} + +
+
- - ))} - - {formStep == 1 && ( - <> - - { - // Can be utilized for logging purposes - }} - > - {(formikProps) => { - setFormValues(formikProps.values); - handleFormStatusChange( - formikProps.isValid && isFormSubmittable(formikProps.values) - ); - setAllowAdvanced( - formikProps.isValid && isFormSubmittable(formikProps.values) - ); - - return ( -
- - {isPaidEnterpriseFeaturesEnabled && ( - <> - - - )} -
- ); - }} -
-
-
- {!noCredentials ? ( - - ) : ( -
- )} - - - {!(connector == "file") && ( -
- -
- )} -
- - )} - - {formStep === 2 && ( - <> - - {}} - > - {(formikProps) => { - setAdvancedSettings(formikProps.values); - - return ( + + } + title={displayName} + /> + + {formStep == 0 && ( + + Select a credential + + {connector == "google_drive" ? ( + + ) : connector == "gmail" ? ( + + ) : ( <> - -
+ + {!createConnectorToggle && ( -
+ )} + + {/* NOTE: connector will never be google_drive, since the ternary above will + prevent that, but still keeping this here for safety in case the above changes. */} + {(connector as ValidSources) !== "google_drive" && + createConnectorToggle && ( + setCreateConnectorToggle(false)} + > + <> + + Create a {getSourceDisplayName(connector)}{" "} + credential + + setCreateConnectorToggle(false)} + /> + + + )} - ); - }} -
-
-
- - + )} + + )} + + {formStep == 1 && ( + + + + + + )} + + {formStep === 2 && ( + + + + )} + + {!(formStep == 0 && connector == "google_drive") && ( + + )}
- - )} -
+ ); + }} + ); } diff --git a/web/src/app/admin/connectors/[connector]/NavigationRow.tsx b/web/src/app/admin/connectors/[connector]/NavigationRow.tsx new file mode 100644 index 00000000000..933e4c9d06f --- /dev/null +++ b/web/src/app/admin/connectors/[connector]/NavigationRow.tsx @@ -0,0 +1,91 @@ +import { useFormContext } from "@/components/context/FormContext"; +import { ArrowLeft, ArrowRight } from "@phosphor-icons/react"; +import { FiPlus } from "react-icons/fi"; + +const NavigationRow = ({ + noAdvanced, + noCredentials, + activatedCredential, + onSubmit, + isValid, +}: { + isValid: boolean; + onSubmit: () => void; + noAdvanced: boolean; + noCredentials: boolean; + activatedCredential: boolean; +}) => { + const { formStep, prevFormStep, nextFormStep } = useFormContext(); + const SquareNavigationButton = ({ + onClick, + disabled, + className, + children, + }: { + onClick: () => void; + disabled?: boolean; + className: string; + children: React.ReactNode; + }) => ( + + ); + + return ( +
+
+ {formStep > 0 && !noCredentials && ( + + + Previous + + )} +
+ +
+ {(formStep > 0 || noCredentials) && ( + + Create Connector + + + )} +
+ +
+ {formStep === 0 && ( + + Continue + + + )} + {noAdvanced && formStep === 1 && ( + + Advanced + + + )} +
+
+ ); +}; +export default NavigationRow; diff --git a/web/src/app/admin/connectors/[connector]/pages/Advanced.tsx b/web/src/app/admin/connectors/[connector]/pages/Advanced.tsx index 8bb96d54db1..0f50a7043b8 100644 --- a/web/src/app/admin/connectors/[connector]/pages/Advanced.tsx +++ b/web/src/app/admin/connectors/[connector]/pages/Advanced.tsx @@ -1,66 +1,47 @@ -import React, { Dispatch, forwardRef, SetStateAction } from "react"; -import { Formik, Form, FormikProps } from "formik"; -import * as Yup from "yup"; +import React from "react"; import NumberInput from "./ConnectorInput/NumberInput"; import { TextFormField } from "@/components/admin/connectors/Field"; +import { TrashIcon } from "@/components/icons/icons"; -interface AdvancedFormPageProps { - formikProps: FormikProps<{ - indexingStart: string | null; - pruneFreq: number; - refreshFreq: number; - }>; -} +const AdvancedFormPage = () => { + return ( +
+

+ Advanced Configuration +

-const AdvancedFormPage = forwardRef, AdvancedFormPageProps>( - ({ formikProps }, ref) => { - const { indexingStart, refreshFreq, pruneFreq } = formikProps.values; + - return ( -
-

- Advanced Configuration -

+ -
-
- -
- -
- -
- -
- -
-
+ +
+
- ); - } -); +
+ ); +}; -AdvancedFormPage.displayName = "AdvancedFormPage"; export default AdvancedFormPage; diff --git a/web/src/app/admin/connectors/[connector]/pages/ConnectorInput/NumberInput.tsx b/web/src/app/admin/connectors/[connector]/pages/ConnectorInput/NumberInput.tsx index a62864495ef..b7fcb49cf1e 100644 --- a/web/src/app/admin/connectors/[connector]/pages/ConnectorInput/NumberInput.tsx +++ b/web/src/app/admin/connectors/[connector]/pages/ConnectorInput/NumberInput.tsx @@ -3,23 +3,17 @@ import { Field, useFormikContext } from "formik"; export default function NumberInput({ label, - value, optional, description, name, showNeverIfZero, - onChange, }: { - value?: number; label: string; name: string; optional?: boolean; description?: string; showNeverIfZero?: boolean; - onChange?: (value: number) => void; }) { - const { setFieldValue } = useFormikContext(); - return (
- )} - + > + + Add Language + +
+ )} + - ) => { - const checked = e.target.checked; - updateAdvancedEmbeddingDetails("multipass_indexing", checked); - setFieldValue("multipass_indexing", checked); - }} - label="Multipass Indexing" - name="multipassIndexing" - /> - ) => { - const checked = e.target.checked; - updateAdvancedEmbeddingDetails( - "disable_rerank_for_streaming", - checked - ); - setFieldValue("disable_rerank_for_streaming", checked); - }} - label="Disable Rerank for Streaming" - name="disableRerankForStreaming" - /> - { - updateNumRerank(value); - setFieldValue("num_rerank", value); - }} - description="Number of results to rerank" - optional={false} - value={values.num_rerank} - label="Number of Results to Rerank" - name="num_rerank" - /> - - )} - -
- ); - } -); + + + + + )} +
+
+ ); +}); +export default AdvancedEmbeddingFormPage; AdvancedEmbeddingFormPage.displayName = "AdvancedEmbeddingFormPage"; -export default AdvancedEmbeddingFormPage; diff --git a/web/src/app/admin/embeddings/pages/EmbeddingFormPage.tsx b/web/src/app/admin/embeddings/pages/EmbeddingFormPage.tsx index 6415daf88f5..733850f0881 100644 --- a/web/src/app/admin/embeddings/pages/EmbeddingFormPage.tsx +++ b/web/src/app/admin/embeddings/pages/EmbeddingFormPage.tsx @@ -41,11 +41,11 @@ export default function EmbeddingForm() { multilingual_expansion: [], disable_rerank_for_streaming: false, api_url: null, + num_rerank: 0, }); const [rerankingDetails, setRerankingDetails] = useState({ rerank_api_key: "", - num_rerank: 0, rerank_provider_type: null, rerank_model_name: "", rerank_api_url: null, @@ -117,11 +117,12 @@ export default function EmbeddingForm() { multilingual_expansion: searchSettings.multilingual_expansion, disable_rerank_for_streaming: searchSettings.disable_rerank_for_streaming, + num_rerank: searchSettings.num_rerank, api_url: null, }); + setRerankingDetails({ rerank_api_key: searchSettings.rerank_api_key, - num_rerank: searchSettings.num_rerank, rerank_provider_type: searchSettings.rerank_provider_type, rerank_model_name: searchSettings.rerank_model_name, rerank_api_url: searchSettings.rerank_api_url, @@ -132,14 +133,12 @@ export default function EmbeddingForm() { const originalRerankingDetails: RerankingDetails = searchSettings ? { rerank_api_key: searchSettings.rerank_api_key, - num_rerank: searchSettings.num_rerank, rerank_provider_type: searchSettings.rerank_provider_type, rerank_model_name: searchSettings.rerank_model_name, rerank_api_url: searchSettings.rerank_api_url, } : { rerank_api_key: "", - num_rerank: 0, rerank_provider_type: null, rerank_model_name: "", rerank_api_url: null, @@ -420,13 +419,6 @@ export default function EmbeddingForm() { <> - setRerankingDetails({ - ...rerankingDetails, - num_rerank: newNumRerank, - }) - } - numRerank={rerankingDetails.num_rerank} advancedEmbeddingDetails={advancedEmbeddingDetails} updateAdvancedEmbeddingDetails={updateAdvancedEmbeddingDetails} /> diff --git a/web/src/app/ee/admin/groups/UserGroupCreationForm.tsx b/web/src/app/ee/admin/groups/UserGroupCreationForm.tsx index dcc3422c4e8..c87bfb5e584 100644 --- a/web/src/app/ee/admin/groups/UserGroupCreationForm.tsx +++ b/web/src/app/ee/admin/groups/UserGroupCreationForm.tsx @@ -29,7 +29,7 @@ export const UserGroupCreationForm = ({ const isUpdate = existingUserGroup !== undefined; return ( - +

{isUpdate ? "Update a User Group" : "Create a new User Group"} diff --git a/web/src/components/admin/connectors/Field.tsx b/web/src/components/admin/connectors/Field.tsx index cbbc7b6d5ce..a76dfbad17c 100644 --- a/web/src/components/admin/connectors/Field.tsx +++ b/web/src/components/admin/connectors/Field.tsx @@ -104,7 +104,6 @@ export function TextFormField({ subtext, placeholder, value, - onChange, type = "text", optional, includeRevert, @@ -121,6 +120,8 @@ export function TextFormField({ explanationLink, small, removeLabel, + min, + onChange, }: { value?: string; name: string; @@ -128,7 +129,6 @@ export function TextFormField({ label: string; subtext?: string | JSX.Element; placeholder?: string; - onChange?: (e: React.ChangeEvent) => void; includeRevert?: boolean; optional?: boolean; type?: string; @@ -144,11 +144,14 @@ export function TextFormField({ explanationText?: string; explanationLink?: string; small?: boolean; + min?: number; + onChange?: (e: React.ChangeEvent) => void; }) { let heightString = defaultHeight || ""; if (isTextArea && !heightString) { heightString = "h-28"; } + const [field, , helpers] = useField(name); const { setValue } = helpers; @@ -186,6 +189,8 @@ export function TextFormField({ {subtext && {subtext}}
- {includeRevert && ( -
- -
- )}
{explanationText && ( diff --git a/web/src/components/admin/connectors/FileUpload.tsx b/web/src/components/admin/connectors/FileUpload.tsx index 52dbef6006d..ea778153dac 100644 --- a/web/src/components/admin/connectors/FileUpload.tsx +++ b/web/src/components/admin/connectors/FileUpload.tsx @@ -1,3 +1,4 @@ +import { useFormikContext } from "formik"; import { FC, useState } from "react"; import React from "react"; import Dropzone from "react-dropzone"; @@ -6,14 +7,17 @@ interface FileUploadProps { selectedFiles: File[]; setSelectedFiles: (files: File[]) => void; message?: string; + name?: string; } export const FileUpload: FC = ({ + name, selectedFiles, setSelectedFiles, message, }) => { const [dragActive, setDragActive] = useState(false); + const { setFieldValue } = useFormikContext(); return (
@@ -21,6 +25,9 @@ export const FileUpload: FC = ({ onDrop={(acceptedFiles) => { setSelectedFiles(acceptedFiles); setDragActive(false); + if (name) { + setFieldValue(name, acceptedFiles); + } }} onDragLeave={() => setDragActive(false)} onDragEnter={() => setDragActive(true)} diff --git a/web/src/components/credentials/actions/CreateCredential.tsx b/web/src/components/credentials/actions/CreateCredential.tsx index 36c204d94ce..7e19e274a88 100644 --- a/web/src/components/credentials/actions/CreateCredential.tsx +++ b/web/src/components/credentials/actions/CreateCredential.tsx @@ -1,10 +1,10 @@ -import React, { useState, useEffect } from "react"; +import React, { useState } from "react"; import { Button, Card } from "@tremor/react"; import { ValidSources } from "@/lib/types"; import { FaAccusoft } from "react-icons/fa"; import { submitCredential } from "@/components/admin/connectors/CredentialForm"; import { TextFormField } from "@/components/admin/connectors/Field"; -import { Form, Formik, FormikHelpers, FormikProps } from "formik"; +import { Form, Formik, FormikHelpers } from "formik"; import { PopupSpec } from "@/components/admin/connectors/Popup"; import { getSourceDocLink } from "@/lib/sources"; import GDriveMain from "@/app/admin/connectors/[connector]/pages/gdrive/GoogleDrivePage"; diff --git a/web/src/components/credentials/actions/EditCredential.tsx b/web/src/components/credentials/actions/EditCredential.tsx index 34883b47039..12b666bba58 100644 --- a/web/src/components/credentials/actions/EditCredential.tsx +++ b/web/src/components/credentials/actions/EditCredential.tsx @@ -1,7 +1,7 @@ import React from "react"; import { Button, Text, Card } from "@tremor/react"; -import { FaNewspaper } from "react-icons/fa"; +import { FaNewspaper, FaPaperPlane, FaTractor, FaTrash } from "react-icons/fa"; import { TextFormField } from "@/components/admin/connectors/Field"; import { Form, Formik, FormikHelpers } from "formik"; import { PopupSpec } from "@/components/admin/connectors/Popup"; @@ -48,7 +48,7 @@ const EditCredential = ({ }; return ( -
+
Ensure that you update to a credential with the proper permissions! @@ -58,37 +58,37 @@ const EditCredential = ({ validationSchema={validationSchema} onSubmit={handleSubmit} > - {({ isSubmitting, setFieldValue }) => ( + {({ isSubmitting, resetForm }) => (
- + + + {Object.entries(credential.credential_json).map(([key, value]) => ( setFieldValue("name", e.target.value)} - name="name" - placeholder={credential.name || ""} - label="Name (optional):" + key={key} + name={key} + placeholder={value} + label={getDisplayNameForCredentialKey(key)} + type={ + key.toLowerCase().includes("token") || + key.toLowerCase().includes("password") + ? "password" + : "text" + } /> - - {Object.entries(credential.credential_json).map( - ([key, value]) => ( - setFieldValue(key, e.target.value)} - name={key} - placeholder={value} - label={getDisplayNameForCredentialKey(key)} - type={ - key.toLowerCase().includes("token") || - key.toLowerCase().includes("password") - ? "password" - : "text" - } - /> - ) - )} - -
+ ))} +
+
)} - ); } From 1ee9b768d1d469a650127fe4071d8ffa3bd29d82 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Mon, 9 Sep 2024 13:53:42 -0700 Subject: [PATCH 3/8] update ports --- backend/danswer/configs/app_configs.py | 2 +- deployment/docker_compose/docker-compose.dev.yml | 2 +- deployment/docker_compose/docker-compose.gpu-dev.yml | 2 +- deployment/docker_compose/docker-compose.search-testing.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index f53daf3a68e..d7733fdc0ab 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -134,7 +134,7 @@ os.environ.get("POSTGRES_PASSWORD") or "password" ) POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost" -POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433" +POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432" POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres" # defaults to False diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index deef76ada17..eb5ba5efc88 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -287,7 +287,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433:5432" + - "5432:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.gpu-dev.yml b/deployment/docker_compose/docker-compose.gpu-dev.yml index c2e2991e103..74da119737e 100644 --- a/deployment/docker_compose/docker-compose.gpu-dev.yml +++ b/deployment/docker_compose/docker-compose.gpu-dev.yml @@ -295,7 +295,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433:5432" + - "5432:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.search-testing.yml b/deployment/docker_compose/docker-compose.search-testing.yml index c477e85512d..ecd796f6716 100644 --- a/deployment/docker_compose/docker-compose.search-testing.yml +++ b/deployment/docker_compose/docker-compose.search-testing.yml @@ -153,7 +153,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433" + - "5432" volumes: - db_volume:/var/lib/postgresql/data From f0ccb110614ff02d02f21b498caa0ca1db5389bb Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 10 Sep 2024 08:23:44 -0700 Subject: [PATCH 4/8] ports --- backend/danswer/configs/app_configs.py | 2 +- deployment/docker_compose/docker-compose.dev.yml | 2 +- deployment/docker_compose/docker-compose.gpu-dev.yml | 2 +- deployment/docker_compose/docker-compose.search-testing.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index d7733fdc0ab..f53daf3a68e 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -134,7 +134,7 @@ os.environ.get("POSTGRES_PASSWORD") or "password" ) POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost" -POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432" +POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433" POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres" # defaults to False diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index eb5ba5efc88..deef76ada17 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -287,7 +287,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432:5432" + - "5433:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.gpu-dev.yml b/deployment/docker_compose/docker-compose.gpu-dev.yml index 74da119737e..c2e2991e103 100644 --- a/deployment/docker_compose/docker-compose.gpu-dev.yml +++ b/deployment/docker_compose/docker-compose.gpu-dev.yml @@ -295,7 +295,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432:5432" + - "5433:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.search-testing.yml b/deployment/docker_compose/docker-compose.search-testing.yml index ecd796f6716..c477e85512d 100644 --- a/deployment/docker_compose/docker-compose.search-testing.yml +++ b/deployment/docker_compose/docker-compose.search-testing.yml @@ -153,7 +153,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432" + - "5433" volumes: - db_volume:/var/lib/postgresql/data From 3da25aeeeeef4bdaf0b8b2ed3e256ce354aaa409 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 10 Sep 2024 08:48:47 -0700 Subject: [PATCH 5/8] remove some number of unnecessary lines --- backend/danswer/configs/app_configs.py | 2 +- .../docker_compose/docker-compose.dev.yml | 2 +- .../docker_compose/docker-compose.gpu-dev.yml | 2 +- .../docker-compose.search-testing.yml | 2 +- .../app/admin/assistants/AssistantEditor.tsx | 24 +++++++---------- .../llm/CustomLLMProviderUpdateForm.tsx | 27 +++++-------------- .../[connector]/AddConnectorPage.tsx | 16 +++++------ web/src/components/IsPublicGroupSelector.tsx | 7 ++++- .../credentials/actions/CreateCredential.tsx | 2 +- 9 files changed, 34 insertions(+), 50 deletions(-) diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index f53daf3a68e..d7733fdc0ab 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -134,7 +134,7 @@ os.environ.get("POSTGRES_PASSWORD") or "password" ) POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost" -POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433" +POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432" POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres" # defaults to False diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index deef76ada17..eb5ba5efc88 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -287,7 +287,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433:5432" + - "5432:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.gpu-dev.yml b/deployment/docker_compose/docker-compose.gpu-dev.yml index c2e2991e103..74da119737e 100644 --- a/deployment/docker_compose/docker-compose.gpu-dev.yml +++ b/deployment/docker_compose/docker-compose.gpu-dev.yml @@ -295,7 +295,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433:5432" + - "5432:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.search-testing.yml b/deployment/docker_compose/docker-compose.search-testing.yml index c477e85512d..ecd796f6716 100644 --- a/deployment/docker_compose/docker-compose.search-testing.yml +++ b/deployment/docker_compose/docker-compose.search-testing.yml @@ -153,7 +153,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433" + - "5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/web/src/app/admin/assistants/AssistantEditor.tsx b/web/src/app/admin/assistants/AssistantEditor.tsx index f8bdf55f745..1c32beae14a 100644 --- a/web/src/app/admin/assistants/AssistantEditor.tsx +++ b/web/src/app/admin/assistants/AssistantEditor.tsx @@ -1184,20 +1184,16 @@ export function AssistantEditor({ />
- {isPaidEnterpriseFeaturesEnabled && - userGroups && - userGroups.length > 0 && ( - - )} + )} diff --git a/web/src/app/admin/configuration/llm/CustomLLMProviderUpdateForm.tsx b/web/src/app/admin/configuration/llm/CustomLLMProviderUpdateForm.tsx index 6a9c0756cb9..5252e6aede5 100644 --- a/web/src/app/admin/configuration/llm/CustomLLMProviderUpdateForm.tsx +++ b/web/src/app/admin/configuration/llm/CustomLLMProviderUpdateForm.tsx @@ -420,27 +420,12 @@ export function CustomLLMProviderUpdateForm({ /> {showAdvancedOptions && ( - <> - {isPaidEnterpriseFeaturesEnabled && userGroups && ( - <> - - - - - )} - + )}
diff --git a/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx b/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx index b008a54aae8..af30479aaa0 100644 --- a/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx +++ b/web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx @@ -379,15 +379,13 @@ export default function AddConnector({ )} - {!(formStep == 0 && connector == "google_drive") && ( - - )} +
); }} diff --git a/web/src/components/IsPublicGroupSelector.tsx b/web/src/components/IsPublicGroupSelector.tsx index f48c112b853..c5c73a82c2d 100644 --- a/web/src/components/IsPublicGroupSelector.tsx +++ b/web/src/components/IsPublicGroupSelector.tsx @@ -1,3 +1,4 @@ +import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled"; import React, { useState, useEffect } from "react"; import { FormikProps, FieldArray, ArrayHelpers, ErrorMessage } from "formik"; import { Text, Divider } from "@tremor/react"; @@ -27,10 +28,11 @@ export const IsPublicGroupSelector = ({ }) => { const { data: userGroups, isLoading: userGroupsIsLoading } = useUserGroups(); const { isAdmin, user, isLoadingUser, isCurator } = useUser(); + const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled(); const [shouldHideContent, setShouldHideContent] = useState(false); useEffect(() => { - if (user && userGroups) { + if (user && userGroups && isPaidEnterpriseFeaturesEnabled) { const isUserAdmin = user.role === UserRole.ADMIN; if (!isUserAdmin) { formikProps.setFieldValue("is_public", false); @@ -55,6 +57,9 @@ export const IsPublicGroupSelector = ({ if (isLoadingUser || userGroupsIsLoading) { return
Loading...
; } + if (!isPaidEnterpriseFeaturesEnabled) { + return null; + } if (shouldHideContent && enforceGroupSelection) { return ( diff --git a/web/src/components/credentials/actions/CreateCredential.tsx b/web/src/components/credentials/actions/CreateCredential.tsx index 7e19e274a88..5188f3d02a4 100644 --- a/web/src/components/credentials/actions/CreateCredential.tsx +++ b/web/src/components/credentials/actions/CreateCredential.tsx @@ -178,7 +178,7 @@ export default function CreateCredential({ initialValues={ { name: "", - is_public: isAdmin, + is_public: isAdmin || !isPaidEnterpriseFeaturesEnabled, groups: [], } as formType } From b3a0f5a92532847e687cc08fb1ce9c1f2ede5cab Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 10 Sep 2024 09:40:24 -0700 Subject: [PATCH 6/8] remove unnecssary isPublicGroupSelector checks in all spots --- web/src/components/credentials/actions/CreateCredential.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/components/credentials/actions/CreateCredential.tsx b/web/src/components/credentials/actions/CreateCredential.tsx index 5188f3d02a4..0a5d3cb23ca 100644 --- a/web/src/components/credentials/actions/CreateCredential.tsx +++ b/web/src/components/credentials/actions/CreateCredential.tsx @@ -232,7 +232,7 @@ export default function CreateCredential({ setShowAdvancedOptions={setShowAdvancedOptions} /> )} - {(showAdvancedOptions || !isAdmin) && ( + {showAdvancedOptions && ( Date: Tue, 10 Sep 2024 09:41:39 -0700 Subject: [PATCH 7/8] add comment --- web/src/components/IsPublicGroupSelector.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/src/components/IsPublicGroupSelector.tsx b/web/src/components/IsPublicGroupSelector.tsx index c5c73a82c2d..6c7aaa17097 100644 --- a/web/src/components/IsPublicGroupSelector.tsx +++ b/web/src/components/IsPublicGroupSelector.tsx @@ -13,6 +13,8 @@ export type IsPublicGroupSelectorFormType = { groups: number[]; }; +// This should be included for all forms that require groups / public access +// to be set, and access to this / permissioning should be handled within this component itself. export const IsPublicGroupSelector = ({ formikProps, objectName, From 87e21180ce79e7bdcb279abd560def610dcdc165 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 10 Sep 2024 10:00:53 -0700 Subject: [PATCH 8/8] update building --- web/src/app/admin/embeddings/interfaces.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/web/src/app/admin/embeddings/interfaces.ts b/web/src/app/admin/embeddings/interfaces.ts index 8426854d49e..c3e0395af65 100644 --- a/web/src/app/admin/embeddings/interfaces.ts +++ b/web/src/app/admin/embeddings/interfaces.ts @@ -7,7 +7,6 @@ export interface RerankingDetails { rerank_provider_type: RerankerProvider | null; rerank_api_key: string | null; rerank_api_url: string | null; - num_rerank: number; } export enum RerankerProvider {