diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index 44294d9859..0772f4911a 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -1,6 +1,6 @@ 'use client' import type { FC, PropsWithChildren } from 'react' -import React, { useCallback, useEffect, useRef, useState } from 'react' +import React, { useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { useContext } from 'use-context-selector' import { @@ -10,7 +10,6 @@ import { } from '@remixicon/react' import Link from 'next/link' import Image from 'next/image' -import { useHover } from 'ahooks' import SettingCog from '../assets/setting-gear-mod.svg' import OrangeEffect from '../assets/option-card-effect-orange.svg' import FamilyMod from '../assets/family-mod.svg' @@ -60,7 +59,6 @@ import Badge from '@/app/components/base/badge' import { SkeletonContainer, SkeletonPoint, SkeletonRectangle, SkeletonRow } from '@/app/components/base/skeleton' import Tooltip from '@/app/components/base/tooltip' import CustomDialog from '@/app/components/base/dialog' -import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigger } from '@/app/components/base/portal-to-follow-elem' import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback' import { noop } from 'lodash-es' import { useDocLink } from '@/context/i18n' @@ -611,9 +609,6 @@ const StepTwo = ({ setIndexType(isAPIKeySet ? IndexingType.QUALIFIED : IndexingType.ECONOMICAL) }, [isAPIKeySet, indexingType, datasetId]) - const economyDomRef = useRef(null) - const isHoveringEconomy = useHover(economyDomRef) - const isModelAndRetrievalConfigDisabled = !!datasetId && !!currentDataset?.data_source_type return ( @@ -873,7 +868,8 @@ const StepTwo = ({
{t('datasetCreation.stepTwo.indexMode')}
{(!hasSetIndexType || (hasSetIndexType && indexingType === IndexingType.QUALIFIED)) && ( - {t('datasetCreation.stepTwo.qualified')} @@ -919,26 +915,8 @@ const StepTwo = ({
- - - } - isActive={!hasSetIndexType && indexType === IndexingType.ECONOMICAL} - disabled={hasSetIndexType || docForm !== ChunkingMode.text} - ref={economyDomRef} - onSwitched={() => { - setIndexType(IndexingType.ECONOMICAL) - }} - /> - - + { docForm === ChunkingMode.qa @@ -946,8 +924,24 @@ const StepTwo = ({ : t('datasetCreation.stepTwo.notAvailableForParentChild') } - - + } + noDecoration + position='top' + asChild={false} + triggerClassName='flex-1 self-stretch' + > + } + isActive={!hasSetIndexType && indexType === IndexingType.ECONOMICAL} + disabled={hasSetIndexType || docForm !== ChunkingMode.text} + onSwitched={() => { + setIndexType(IndexingType.ECONOMICAL) + }} + /> + )} {!hasSetIndexType && indexType === IndexingType.QUALIFIED && ( diff --git a/web/app/components/datasets/create/step-two/option-card.tsx b/web/app/components/datasets/create/step-two/option-card.tsx index 6bfe538da2..7e901c913a 100644 --- a/web/app/components/datasets/create/step-two/option-card.tsx +++ b/web/app/components/datasets/create/step-two/option-card.tsx @@ -21,7 +21,7 @@ type OptionCardHeaderProps = { export const OptionCardHeader: FC = (props) => { const { icon, title, description, isActive, activeClassName, effectImg, disabled } = props return
@@ -34,7 +34,7 @@ export const OptionCardHeader: FC = (props) => {
{title}
@@ -64,43 +64,45 @@ export const OptionCard: FC = ( }, ) => { const { icon, className, title, description, isActive, children, actions, activeHeaderClassName, style, effectImg, onSwitched, noHighlight, disabled, ...rest } = props - return
{ - if (!isActive && !disabled) - onSwitched?.() - }} - {...rest} - ref={ref} - > - - {/** Body */} - {isActive && (children || actions) &&
- {children} - {actions &&
- {actions} -
- } -
} -
+ return ( +
{ + if (!isActive && !disabled) + onSwitched?.() + }} + {...rest} + ref={ref} + > + + {/** Body */} + {isActive && (children || actions) &&
+ {children} + {actions &&
+ {actions} +
+ } +
} +
+ ) } OptionCard.displayName = 'OptionCard'