mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-22 06:06:40 +08:00
### What problem does this PR solve? Feat: Retrieval test #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -106,7 +106,7 @@ function RerankFormField() {
|
||||
name={RerankId}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('rerankModel')}</FormLabel>
|
||||
<FormLabel tooltip={t('rerankTip')}>{t('rerankModel')}</FormLabel>
|
||||
<FormControl>
|
||||
<Select onValueChange={field.onChange} {...field}>
|
||||
<SelectTrigger
|
||||
@ -156,7 +156,7 @@ export function RerankFormFields() {
|
||||
name={'top_k'}
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t('topK')}</FormLabel>
|
||||
<FormLabel tooltip={t('topKTip')}>{t('topK')}</FormLabel>
|
||||
<FormControl>
|
||||
<SingleFormSlider
|
||||
{...field}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { Form, Slider } from 'antd';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
import { z } from 'zod';
|
||||
import { SingleFormSlider } from '../ui/dual-range-slider';
|
||||
import {
|
||||
FormControl,
|
||||
@ -55,6 +56,19 @@ interface SimilaritySliderFormFieldProps {
|
||||
isTooltipShown?: boolean;
|
||||
}
|
||||
|
||||
export const initialSimilarityThresholdValue = {
|
||||
similarity_threshold: 0.2,
|
||||
};
|
||||
export const initialKeywordsSimilarityWeightValue = {
|
||||
keywords_similarity_weight: 0.7,
|
||||
};
|
||||
|
||||
export const similarityThresholdSchema = { similarity_threshold: z.number() };
|
||||
|
||||
export const keywordsSimilarityWeightSchema = {
|
||||
keywords_similarity_weight: z.number(),
|
||||
};
|
||||
|
||||
export function SimilaritySliderFormField({
|
||||
vectorSimilarityWeightName = 'vector_similarity_weight',
|
||||
isTooltipShown,
|
||||
|
||||
@ -5,15 +5,23 @@ import {
|
||||
FormLabel,
|
||||
} from '@/components/ui/form';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { ReactNode } from 'react';
|
||||
import { useFormContext } from 'react-hook-form';
|
||||
|
||||
interface SwitchFormItemProps {
|
||||
name: string;
|
||||
label: ReactNode;
|
||||
vertical?: boolean;
|
||||
tooltip?: ReactNode;
|
||||
}
|
||||
|
||||
export function SwitchFormField({ label, name }: SwitchFormItemProps) {
|
||||
export function SwitchFormField({
|
||||
label,
|
||||
name,
|
||||
vertical = true,
|
||||
tooltip,
|
||||
}: SwitchFormItemProps) {
|
||||
const form = useFormContext();
|
||||
|
||||
return (
|
||||
@ -21,8 +29,14 @@ export function SwitchFormField({ label, name }: SwitchFormItemProps) {
|
||||
control={form.control}
|
||||
name={name}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex justify-between">
|
||||
<FormLabel className="text-base">{label}</FormLabel>
|
||||
<FormItem
|
||||
className={cn('flex', {
|
||||
'gap-2': vertical,
|
||||
'flex-col': vertical,
|
||||
'justify-between': !vertical,
|
||||
})}
|
||||
>
|
||||
<FormLabel tooltip={tooltip}>{label}</FormLabel>
|
||||
<FormControl>
|
||||
<Switch
|
||||
checked={field.value}
|
||||
|
||||
@ -34,6 +34,7 @@ export function UseKnowledgeGraphFormField({
|
||||
<SwitchFormField
|
||||
name={name}
|
||||
label={t('chat.useKnowledgeGraph')}
|
||||
tooltip={t('chat.useKnowledgeGraphTip')}
|
||||
></SwitchFormField>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user