mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat(next-search): Added AI summary functionality #3221 - Added the LlmSettingFieldItems component for AI summary settings - Updated the SearchSetting component to integrate AI summary functionality - Added the updateSearch hook and related service methods - Modified the ISearchAppDetailProps interface to add the llm_setting field ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -158,6 +158,15 @@ export const useDeleteSearch = () => {
|
||||
return { data, isLoading, isError, deleteSearch };
|
||||
};
|
||||
|
||||
interface IllmSettingProps {
|
||||
llm_id: string;
|
||||
parameter: string;
|
||||
temperature: number;
|
||||
top_p: number;
|
||||
frequency_penalty: number;
|
||||
presence_penalty: number;
|
||||
}
|
||||
|
||||
export interface ISearchAppDetailProps {
|
||||
avatar: any;
|
||||
created_by: string;
|
||||
@ -175,10 +184,12 @@ export interface ISearchAppDetailProps {
|
||||
rerank_id: string;
|
||||
similarity_threshold: number;
|
||||
summary: boolean;
|
||||
llm_setting: IllmSettingProps;
|
||||
top_k: number;
|
||||
use_kg: boolean;
|
||||
vector_similarity_weight: number;
|
||||
web_search: boolean;
|
||||
chat_settingcross_languages: string[];
|
||||
};
|
||||
tenant_id: string;
|
||||
update_time: number;
|
||||
@ -207,3 +218,43 @@ export const useFetchSearchDetail = () => {
|
||||
|
||||
return { data: data?.data, isLoading, isError };
|
||||
};
|
||||
|
||||
export type IUpdateSearchProps = Omit<ISearchAppDetailProps, 'id'> & {
|
||||
search_id: string;
|
||||
};
|
||||
|
||||
export const useUpdateSearch = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const {
|
||||
data,
|
||||
isLoading,
|
||||
isError,
|
||||
mutateAsync: updateSearchMutation,
|
||||
} = useMutation<any, Error, IUpdateSearchProps>({
|
||||
mutationKey: ['updateSearch'],
|
||||
mutationFn: async (formData) => {
|
||||
const { data: response } =
|
||||
await searchService.updateSearchSetting(formData);
|
||||
if (response.code !== 0) {
|
||||
throw new Error(response.message || 'Failed to update search');
|
||||
}
|
||||
return response.data;
|
||||
},
|
||||
onSuccess: () => {
|
||||
message.success(t('message.updated'));
|
||||
},
|
||||
onError: (error) => {
|
||||
message.error(t('message.error', { error: error.message }));
|
||||
},
|
||||
});
|
||||
|
||||
const updateSearch = useCallback(
|
||||
(formData: IUpdateSearchProps) => {
|
||||
return updateSearchMutation(formData);
|
||||
},
|
||||
[updateSearchMutation],
|
||||
);
|
||||
|
||||
return { data, isLoading, isError, updateSearch };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user