Fix: Fixed the issue that similarity threshold modification in chat and search configuration failed #3221 (#9821)

### What problem does this PR solve?

Fix: Fixed the issue that similarity threshold modification in chat and
search configuration failed #3221

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2025-08-29 14:10:10 +08:00
committed by GitHub
parent fcd18d7d87
commit c47a38773c
3 changed files with 11 additions and 6 deletions

View File

@ -51,6 +51,7 @@ export function ChatSettings({ switchSettingVisible }: ChatSettingsProps) {
cross_languages: [],
},
top_n: 8,
similarity_threshold: 0.2,
vector_similarity_weight: 0.2,
top_k: 1024,
meta_data_filter: {

View File

@ -4,7 +4,10 @@ import {
} from '@/components/llm-setting-items/next';
import { MetadataFilterSchema } from '@/components/metadata-filter';
import { rerankFormSchema } from '@/components/rerank';
import { vectorSimilarityWeightSchema } from '@/components/similarity-slider';
import {
similarityThresholdSchema,
vectorSimilarityWeightSchema,
} from '@/components/similarity-slider';
import { topnSchema } from '@/components/top-n-item';
import { useTranslate } from '@/hooks/common-hooks';
import { z } from 'zod';
@ -45,6 +48,7 @@ export function useChatSettingSchema() {
...LlmSettingEnabledSchema,
llm_id: z.string().optional(),
...vectorSimilarityWeightSchema,
...similarityThresholdSchema,
...topnSchema,
...MetadataFilterSchema,
});

View File

@ -5,7 +5,6 @@ import {
MetadataFilter,
MetadataFilterSchema,
} from '@/components/metadata-filter';
import { Input } from '@/components/originui/input';
import { Button } from '@/components/ui/button';
import { SingleFormSlider } from '@/components/ui/dual-range-slider';
import {
@ -16,6 +15,7 @@ import {
FormLabel,
FormMessage,
} from '@/components/ui/form';
import { Input } from '@/components/ui/input';
import {
MultiSelect,
MultiSelectOptionType,
@ -137,10 +137,10 @@ const SearchSetting: React.FC<SearchSettingProps> = ({
llm_setting: {
llm_id: search_config?.chat_id || '',
parameter: llm_setting?.parameter,
temperature: llm_setting?.temperature,
top_p: llm_setting?.top_p,
frequency_penalty: llm_setting?.frequency_penalty,
presence_penalty: llm_setting?.presence_penalty,
temperature: llm_setting?.temperature || 0,
top_p: llm_setting?.top_p || 0,
frequency_penalty: llm_setting?.frequency_penalty || 0,
presence_penalty: llm_setting?.presence_penalty || 0,
temperatureEnabled: llm_setting?.temperature ? true : false,
topPEnabled: llm_setting?.top_p ? true : false,
presencePenaltyEnabled: llm_setting?.presence_penalty ? true : false,