mirror of
https://github.com/langgenius/dify.git
synced 2026-04-27 19:27:23 +08:00
feat: tags
This commit is contained in:
parent
b8ced5102c
commit
361a007f42
@ -1,8 +1,9 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import cn from '@/utils/classnames'
|
||||||
|
|
||||||
const Tag = ({ text }: { text: string }) => {
|
const Tag = ({ text, className }: { text: string; className?: string }) => {
|
||||||
return (
|
return (
|
||||||
<div className='inline-flex items-center gap-x-0.5'>
|
<div className={cn('inline-flex items-center gap-x-0.5', className)}>
|
||||||
<span className='text-text-quaternary text-xs font-medium'>#</span>
|
<span className='text-text-quaternary text-xs font-medium'>#</span>
|
||||||
<span className='text-text-tertiary text-xs'>{text}</span>
|
<span className='text-text-tertiary text-xs'>{text}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import type { FC } from 'react'
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { SegmentIndexTag } from '../../documents/detail/completed'
|
import { SegmentIndexTag } from '../../documents/detail/completed'
|
||||||
|
import Dot from '../../documents/detail/completed/common/dot'
|
||||||
import Score from './score'
|
import Score from './score'
|
||||||
import ChildChunksItem from './child-chunks-item'
|
import ChildChunksItem from './child-chunks-item'
|
||||||
import Modal from '@/app/components/base/modal'
|
import Modal from '@/app/components/base/modal'
|
||||||
@ -10,6 +11,7 @@ import type { HitTesting } from '@/models/datasets'
|
|||||||
import FileIcon from '@/app/components/base/file-uploader/file-type-icon'
|
import FileIcon from '@/app/components/base/file-uploader/file-type-icon'
|
||||||
import type { FileAppearanceTypeEnum } from '@/app/components/base/file-uploader/types'
|
import type { FileAppearanceTypeEnum } from '@/app/components/base/file-uploader/types'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
|
import Tag from '@/app/components/datasets/documents/detail/completed/common/tag'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
payload: HitTesting
|
payload: HitTesting
|
||||||
@ -44,7 +46,7 @@ const ChunkDetailModal: FC<Props> = ({
|
|||||||
positionId={position}
|
positionId={position}
|
||||||
className={cn('w-fit group-hover:opacity-100')}
|
className={cn('w-fit group-hover:opacity-100')}
|
||||||
/>
|
/>
|
||||||
<div className='text-xs font-medium text-text-quaternary'>·</div>
|
<Dot />
|
||||||
<div className='flex items-center space-x-1'>
|
<div className='flex items-center space-x-1'>
|
||||||
<FileIcon type={extension} size='sm' />
|
<FileIcon type={extension} size='sm' />
|
||||||
<span className='grow w-0 truncate text-text-secondary text-[13px] font-normal'>{document.name}</span>
|
<span className='grow w-0 truncate text-text-secondary text-[13px] font-normal'>{document.name}</span>
|
||||||
@ -58,9 +60,11 @@ const ChunkDetailModal: FC<Props> = ({
|
|||||||
{!isParentChildRetrieval && keywords && keywords.length > 0 && (
|
{!isParentChildRetrieval && keywords && keywords.length > 0 && (
|
||||||
<div>
|
<div>
|
||||||
<div>{t('dataset.keywords')}</div>
|
<div>{t('dataset.keywords')}</div>
|
||||||
{keywords.map(keyword => (
|
<div className='flex flex-wrap'>
|
||||||
<div key={keyword} className='inline-block px-1 py-0.5 bg-components-tag-bg text-components-tag-text text-xs rounded-md mr-1'>{keyword}</div>
|
{keywords.map(keyword => (
|
||||||
))}
|
<Tag key={keyword} text={keyword} className='mr-2' />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import { RiArrowDownSLine, RiArrowRightSLine, RiArrowRightUpLine } from '@remixicon/react'
|
import { RiArrowDownSLine, RiArrowRightSLine, RiArrowRightUpLine } from '@remixicon/react'
|
||||||
import { useBoolean } from 'ahooks'
|
import { useBoolean } from 'ahooks'
|
||||||
import { SegmentIndexTag } from '../../documents/detail/completed'
|
import { SegmentIndexTag } from '../../documents/detail/completed'
|
||||||
|
import Dot from '../../documents/detail/completed/common/dot'
|
||||||
import Score from './score'
|
import Score from './score'
|
||||||
import ChildChunkItem from './child-chunks-item'
|
import ChildChunkItem from './child-chunks-item'
|
||||||
import ChunkDetailModal from './chunk-detail-modal'
|
import ChunkDetailModal from './chunk-detail-modal'
|
||||||
@ -12,6 +13,7 @@ import type { HitTesting } from '@/models/datasets'
|
|||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
import FileIcon from '@/app/components/base/file-uploader/file-type-icon'
|
import FileIcon from '@/app/components/base/file-uploader/file-type-icon'
|
||||||
import type { FileAppearanceTypeEnum } from '@/app/components/base/file-uploader/types'
|
import type { FileAppearanceTypeEnum } from '@/app/components/base/file-uploader/types'
|
||||||
|
import Tag from '@/app/components/datasets/documents/detail/completed/common/tag'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
payload: HitTesting
|
payload: HitTesting
|
||||||
@ -45,7 +47,7 @@ const ResultItem: FC<Props> = ({
|
|||||||
positionId={position}
|
positionId={position}
|
||||||
className={cn('w-fit group-hover:opacity-100')}
|
className={cn('w-fit group-hover:opacity-100')}
|
||||||
/>
|
/>
|
||||||
<div className='text-xs font-medium text-text-quaternary'>·</div>
|
<Dot />
|
||||||
<div className='system-xs-medium text-text-tertiary'>{word_count} {t('datasetDocuments.segment.characters')}</div>
|
<div className='system-xs-medium text-text-tertiary'>{word_count} {t('datasetDocuments.segment.characters')}</div>
|
||||||
</div>
|
</div>
|
||||||
<Score value={score} />
|
<Score value={score} />
|
||||||
@ -66,9 +68,9 @@ const ResultItem: FC<Props> = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!isParentChildRetrieval && keywords && keywords.length > 0 && (
|
{!isParentChildRetrieval && keywords && keywords.length > 0 && (
|
||||||
<div>
|
<div className='flex flex-wrap'>
|
||||||
{keywords.map(keyword => (
|
{keywords.map(keyword => (
|
||||||
<div key={keyword} className='inline-block px-1 py-0.5 bg-components-tag-bg text-components-tag-text text-xs rounded-md mr-1'>{keyword}</div>
|
<Tag key={keyword} text={keyword} className='mr-2' />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user