mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-10 17:31:29 +08:00
refa: simplify RAPTOR tree clustering and configuration (#17614)
This commit is contained in:
@@ -21,7 +21,8 @@ export function TreeTemplateFields({ index }: TreeTemplateFieldsProps) {
|
||||
>
|
||||
<Textarea
|
||||
placeholder={t('setting.descriptionPlaceholder')}
|
||||
rows={6}
|
||||
rows={8}
|
||||
resize="vertical"
|
||||
/>
|
||||
</RAGFlowFormItem>
|
||||
|
||||
@@ -29,12 +30,21 @@ export function TreeTemplateFields({ index }: TreeTemplateFieldsProps) {
|
||||
name={`templates.${index}.config.raptor.max_token`}
|
||||
label={t('setting.maxToken')}
|
||||
max={2048}
|
||||
min={0}
|
||||
min={512}
|
||||
step={1}
|
||||
/>
|
||||
<SliderInputFormField
|
||||
name={`templates.${index}.config.raptor.threshold`}
|
||||
label={t('setting.threshold')}
|
||||
name={`templates.${index}.config.raptor.clustering_threshold`}
|
||||
label={t('setting.clusteringThreshold')}
|
||||
tooltip={t('setting.clusteringThresholdTip')}
|
||||
step={0.01}
|
||||
max={1}
|
||||
min={0}
|
||||
/>
|
||||
<SliderInputFormField
|
||||
name={`templates.${index}.config.raptor.clustering_ratio`}
|
||||
label={t('setting.clusteringRatio')}
|
||||
tooltip={t('setting.clusteringRatioTip')}
|
||||
step={0.01}
|
||||
max={1}
|
||||
min={0}
|
||||
|
||||
@@ -11,8 +11,9 @@ export const buildSectionSchema = (t: (key: string) => string) =>
|
||||
export const buildRaptorConfigSchema = (t: (key: string) => string) =>
|
||||
z.object({
|
||||
prompt: z.string().optional(),
|
||||
max_token: z.number().min(1, t('setting.maxTokenRequired')),
|
||||
threshold: z.number().min(0).max(1),
|
||||
max_token: z.number().min(512, t('setting.maxTokenRequired')).max(2048),
|
||||
clustering_threshold: z.number().min(0).max(1),
|
||||
clustering_ratio: z.number().min(0).max(1),
|
||||
rechunk: z.boolean().optional(),
|
||||
});
|
||||
|
||||
|
||||
@@ -139,7 +139,8 @@ export const buildConfigFromBuiltin = (
|
||||
raptor: {
|
||||
prompt: builtinRaptor.prompt ?? '',
|
||||
max_token: builtinRaptor.max_token ?? 512,
|
||||
threshold: builtinRaptor.threshold ?? 0.1,
|
||||
clustering_threshold: builtinRaptor.clustering_threshold ?? 0.3,
|
||||
clustering_ratio: builtinRaptor.clustering_ratio ?? 0.5,
|
||||
rechunk: builtinRaptor.rechunk ?? false,
|
||||
},
|
||||
};
|
||||
@@ -205,7 +206,8 @@ export const transformDetailToForm = (
|
||||
raptor: {
|
||||
prompt: raptor.prompt ?? '',
|
||||
max_token: raptor.max_token ?? 512,
|
||||
threshold: raptor.threshold ?? 0.1,
|
||||
clustering_threshold: raptor.clustering_threshold ?? 0.3,
|
||||
clustering_ratio: raptor.clustering_ratio ?? 0.5,
|
||||
rechunk: raptor.rechunk ?? false,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -21,7 +21,8 @@ export function TreeTemplateFields({ index }: TreeTemplateFieldsProps) {
|
||||
>
|
||||
<Textarea
|
||||
placeholder={t('setting.descriptionPlaceholder')}
|
||||
rows={6}
|
||||
rows={8}
|
||||
resize="vertical"
|
||||
/>
|
||||
</RAGFlowFormItem>
|
||||
|
||||
@@ -29,12 +30,21 @@ export function TreeTemplateFields({ index }: TreeTemplateFieldsProps) {
|
||||
name={`templates.${index}.config.raptor.max_token`}
|
||||
label={t('setting.maxToken')}
|
||||
max={2048}
|
||||
min={0}
|
||||
min={512}
|
||||
step={1}
|
||||
/>
|
||||
<SliderInputFormField
|
||||
name={`templates.${index}.config.raptor.threshold`}
|
||||
label={t('setting.threshold')}
|
||||
name={`templates.${index}.config.raptor.clustering_threshold`}
|
||||
label={t('setting.clusteringThreshold')}
|
||||
tooltip={t('setting.clusteringThresholdTip')}
|
||||
step={0.01}
|
||||
max={1}
|
||||
min={0}
|
||||
/>
|
||||
<SliderInputFormField
|
||||
name={`templates.${index}.config.raptor.clustering_ratio`}
|
||||
label={t('setting.clusteringRatio')}
|
||||
tooltip={t('setting.clusteringRatioTip')}
|
||||
step={0.01}
|
||||
max={1}
|
||||
min={0}
|
||||
|
||||
@@ -11,8 +11,9 @@ export const buildSectionSchema = (t: (key: string) => string) =>
|
||||
export const buildRaptorConfigSchema = (t: (key: string) => string) =>
|
||||
z.object({
|
||||
prompt: z.string().optional(),
|
||||
max_token: z.number().min(1, t('setting.maxTokenRequired')),
|
||||
threshold: z.number().min(0).max(1),
|
||||
max_token: z.number().min(512, t('setting.maxTokenRequired')).max(2048),
|
||||
clustering_threshold: z.number().min(0).max(1),
|
||||
clustering_ratio: z.number().min(0).max(1),
|
||||
rechunk: z.boolean().optional(),
|
||||
});
|
||||
|
||||
|
||||
@@ -135,7 +135,8 @@ export const buildConfigFromBuiltin = (
|
||||
raptor: {
|
||||
prompt: builtinRaptor.prompt ?? '',
|
||||
max_token: builtinRaptor.max_token ?? 512,
|
||||
threshold: builtinRaptor.threshold ?? 0.1,
|
||||
clustering_threshold: builtinRaptor.clustering_threshold ?? 0.3,
|
||||
clustering_ratio: builtinRaptor.clustering_ratio ?? 0.5,
|
||||
rechunk: builtinRaptor.rechunk ?? false,
|
||||
},
|
||||
};
|
||||
@@ -201,7 +202,8 @@ export const transformDetailToForm = (
|
||||
raptor: {
|
||||
prompt: raptor.prompt ?? '',
|
||||
max_token: raptor.max_token ?? 512,
|
||||
threshold: raptor.threshold ?? 0.1,
|
||||
clustering_threshold: raptor.clustering_threshold ?? 0.3,
|
||||
clustering_ratio: raptor.clustering_ratio ?? 0.5,
|
||||
rechunk: raptor.rechunk ?? false,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user