Refactor: Replace IndexMethodRadio with IndexMethod component, add keyword number functionality, and update related translations

This commit is contained in:
twwu
2025-05-13 15:35:21 +08:00
parent cef6463847
commit 4d68aadc1c
16 changed files with 286 additions and 223 deletions

View File

@ -9,7 +9,8 @@ import { ChunkingMode } from '@/models/datasets'
export const useChunkStructure = () => {
const GeneralOption: Option = {
id: ChunkingMode.text,
icon: <GeneralChunk className='size-[18px] text-util-colors-indigo-indigo-600' />,
icon: <GeneralChunk className='size-[18px]' />,
iconActiveColor: 'text-util-colors-indigo-indigo-600',
title: 'General',
description: 'General text chunking mode, the chunks retrieved and recalled are the same.',
effectColor: EffectColor.indigo,
@ -17,7 +18,8 @@ export const useChunkStructure = () => {
}
const ParentChildOption: Option = {
id: ChunkingMode.parentChild,
icon: <ParentChildChunk className='size-[18px] text-util-colors-blue-light-blue-light-500' />,
icon: <ParentChildChunk className='size-[18px]' />,
iconActiveColor: 'text-util-colors-blue-light-blue-light-500',
title: 'Parent-Child',
description: 'When using the parent-child mode, the child-chunk is used for retrieval and the parent-chunk is used for recall as context.',
effectColor: EffectColor.blueLight,
@ -25,7 +27,7 @@ export const useChunkStructure = () => {
}
const QuestionAnswerOption: Option = {
id: ChunkingMode.qa,
icon: <QuestionAndAnswer className='size-[18px] text-text-tertiary' />,
icon: <QuestionAndAnswer className='size-[18px]' />,
title: 'Q&A',
description: 'When using structured Q&A data, you can create documents that pair questions with answers. These documents are indexed based on the question portion, allowing the system to retrieve relevant answers based on query similarity',
}

View File

@ -24,12 +24,13 @@ const ChunkStructure = ({
key={option.id}
id={option.id}
icon={option.icon}
iconActiveColor={option.iconActiveColor}
title={option.title}
description={option.description}
onClick={() => {
onChunkStructureChange(option.id)
}}
showHighlightBorder={chunkStructure === option.id}
isActive={chunkStructure === option.id}
effectColor={option.effectColor}
showEffectColor
className='gap-x-1.5 p-3 pr-4'

View File

@ -10,6 +10,7 @@ export enum EffectColor {
export type Option = {
id: ChunkingMode
icon?: React.ReactNode
iconActiveColor?: string
title: string
description?: string
effectColor?: EffectColor