mirror of
https://github.com/langgenius/dify.git
synced 2025-08-11 10:47:24 +00:00
44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import type { FC } from 'react'
|
|
import type { ChunkingMode, ParentMode } from '@/models/datasets'
|
|
import { useRouter } from 'next/navigation'
|
|
import DocumentPicker from '../../common/document-picker'
|
|
import cn from '@/utils/classnames'
|
|
|
|
type DocumentTitleProps = {
|
|
datasetId: string
|
|
extension?: string
|
|
name?: string
|
|
chunkingMode?: ChunkingMode
|
|
parent_mode?: ParentMode
|
|
iconCls?: string
|
|
textCls?: string
|
|
wrapperCls?: string
|
|
}
|
|
|
|
export const DocumentTitle: FC<DocumentTitleProps> = ({
|
|
datasetId,
|
|
extension,
|
|
name,
|
|
chunkingMode,
|
|
parent_mode,
|
|
wrapperCls,
|
|
}) => {
|
|
const router = useRouter()
|
|
return (
|
|
<div className={cn('flex flex-1 items-center justify-start', wrapperCls)}>
|
|
<DocumentPicker
|
|
datasetId={datasetId}
|
|
value={{
|
|
name,
|
|
extension,
|
|
chunkingMode,
|
|
parentMode: parent_mode || 'paragraph',
|
|
}}
|
|
onChange={(doc) => {
|
|
router.push(`/datasets/${datasetId}/documents/${doc.id}`)
|
|
}}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|