diff --git a/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx b/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx index 293ab2bc4f..8efdccbffc 100644 --- a/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx +++ b/web/app/components/datasets/documents/detail/completed/child-segment-list.tsx @@ -3,6 +3,7 @@ import { RiArrowDownSLine, RiArrowRightSLine } from '@remixicon/react' import { useTranslation } from 'react-i18next' import { EditSlice } from '../../../formatted-text/flavours/edit-slice' import { useDocumentContext } from '../index' +import { FormattedText } from '../../../formatted-text/formatted' import Empty from './common/empty' import FullDocListSkeleton from './skeleton/full-doc-list-skeleton' import type { ChildChunkDetail } from '@/models/datasets' @@ -135,9 +136,13 @@ const ChildSegmentList: FC = ({ {isLoading ? : null} {((isFullDocMode && !isLoading) || !collapsed) ?
- {isParagraphMode && } + {isParagraphMode && ( +
+ +
+ )} {childChunks.length > 0 - ?
+ ? {childChunks.map((childChunk) => { const edited = childChunk.updated_at !== childChunk.created_at return = ({ text={childChunk.content} onDelete={() => onDelete?.(childChunk.segment_id, childChunk.id)} className='line-clamp-3' + labelClassName='font-semibold' + contentClassName={'!leading-6'} onClick={(e) => { e.stopPropagation() onClickSlice?.(childChunk) }} /> })} -
+ : inputValue !== '' ?
diff --git a/web/app/components/datasets/documents/detail/completed/segment-card.tsx b/web/app/components/datasets/documents/detail/completed/segment-card.tsx index deea30c21e..42d92f7599 100644 --- a/web/app/components/datasets/documents/detail/completed/segment-card.tsx +++ b/web/app/components/datasets/documents/detail/completed/segment-card.tsx @@ -10,7 +10,6 @@ import { SegmentIndexTag } from './common/segment-index-tag' import ParentChunkCardSkeleton from './skeleton/parent-chunk-card-skeleton' import { useSegmentListContext } from './index' import type { ChildChunkDetail, SegmentDetailModel } from '@/models/datasets' -import Indicator from '@/app/components/header/indicator' import Switch from '@/app/components/base/switch' import Divider from '@/app/components/base/divider' import { formatNumber } from '@/utils/format' @@ -157,66 +156,58 @@ const SegmentCard: FC = ({
{!isFullDocMode ?
- {loading - ? ( - - ) - : ( - <> - - {embeddingAvailable && ( -
+ {embeddingAvailable && ( +
- {!archived && ( - <> - -
{ - e.stopPropagation() - onClickEdit?.() - }}> - -
-
- -
{ - e.stopPropagation() - setShowModal(true) - } - }> - -
-
- - - )} + {!archived && ( + <> +
) => + className='shrink-0 w-6 h-6 flex items-center justify-center rounded-lg hover:bg-state-base-hover cursor-pointer' + onClick={(e) => { e.stopPropagation() - } - className="flex items-center" - > - { - await onChangeSwitch?.(val, id) - }} - /> + onClickEdit?.() + }}> +
-
- )} - - )} + + +
{ + e.stopPropagation() + setShowModal(true) + } + }> + +
+
+ + + )} +
) => + e.stopPropagation() + } + className="flex items-center" + > + { + await onChangeSwitch?.(val, id) + }} + /> +
+
+ )}
: null} diff --git a/web/app/components/datasets/formatted-text/flavours/edit-slice.tsx b/web/app/components/datasets/formatted-text/flavours/edit-slice.tsx index 1fe81180c4..0ccb90cf78 100644 --- a/web/app/components/datasets/formatted-text/flavours/edit-slice.tsx +++ b/web/app/components/datasets/formatted-text/flavours/edit-slice.tsx @@ -10,10 +10,12 @@ import ActionButton, { ActionButtonState } from '@/app/components/base/action-bu type EditSliceProps = SliceProps<{ label: ReactNode onDelete: () => void + labelClassName?: string + contentClassName?: string }> export const EditSlice: FC = (props) => { - const { label, className, text, onDelete, ...rest } = props + const { label, className, text, onDelete, labelClassName, contentClassName, ...rest } = props const [delBtnShow, setDelBtnShow] = useState(false) const [isDelBtnHover, setDelBtnHover] = useState(false) @@ -44,12 +46,16 @@ export const EditSlice: FC = (props) => { {label} {text}