mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-31 17:15:32 +08:00
### What problem does this PR solve? feat(search): Added app embedding functionality and optimized search page #3221 - Added an Embed App button and related functionality - Optimized the layout and interaction of the search settings interface - Adjusted the search result display method - Refactored some code to support new features ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { useFetchMindMap, useFetchRelatedQuestions } from '@/hooks/chat-hooks';
|
||||
import { useFetchRelatedQuestions } from '@/hooks/chat-hooks';
|
||||
import { useSetModalState } from '@/hooks/common-hooks';
|
||||
import {
|
||||
useTestChunkAllRetrieval,
|
||||
@ -18,17 +18,23 @@ import {
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import {
|
||||
useGetSharedSearchParams,
|
||||
useSearchFetchMindMap,
|
||||
} from '../next-search/hooks';
|
||||
|
||||
export const useSendQuestion = (kbIds: string[]) => {
|
||||
export const useSendQuestion = (kbIds: string[], tenantId?: string) => {
|
||||
const { sharedId } = useGetSharedSearchParams();
|
||||
const { send, answer, done, stopOutputMessage } = useSendMessageWithSse(
|
||||
api.ask,
|
||||
sharedId ? api.askShare : api.ask,
|
||||
);
|
||||
const { testChunk, loading } = useTestChunkRetrieval();
|
||||
const { testChunkAll } = useTestChunkAllRetrieval();
|
||||
|
||||
const { testChunk, loading } = useTestChunkRetrieval(tenantId);
|
||||
const { testChunkAll } = useTestChunkAllRetrieval(tenantId);
|
||||
const [sendingLoading, setSendingLoading] = useState(false);
|
||||
const [currentAnswer, setCurrentAnswer] = useState({} as IAnswer);
|
||||
const { fetchRelatedQuestions, data: relatedQuestions } =
|
||||
useFetchRelatedQuestions();
|
||||
useFetchRelatedQuestions(tenantId);
|
||||
const [searchStr, setSearchStr] = useState<string>('');
|
||||
const [isFirstRender, setIsFirstRender] = useState(true);
|
||||
const [selectedDocumentIds, setSelectedDocumentIds] = useState<string[]>([]);
|
||||
@ -43,7 +49,7 @@ export const useSendQuestion = (kbIds: string[]) => {
|
||||
setIsFirstRender(false);
|
||||
setCurrentAnswer({} as IAnswer);
|
||||
setSendingLoading(true);
|
||||
send({ kb_ids: kbIds, question: q });
|
||||
send({ kb_ids: kbIds, question: q, tenantId });
|
||||
testChunk({
|
||||
kb_id: kbIds,
|
||||
highlight: true,
|
||||
@ -61,6 +67,7 @@ export const useSendQuestion = (kbIds: string[]) => {
|
||||
fetchRelatedQuestions,
|
||||
setPagination,
|
||||
pagination.pageSize,
|
||||
tenantId,
|
||||
],
|
||||
);
|
||||
|
||||
@ -218,7 +225,7 @@ export const useShowMindMapDrawer = (kbIds: string[], question: string) => {
|
||||
fetchMindMap,
|
||||
data: mindMap,
|
||||
loading: mindMapLoading,
|
||||
} = useFetchMindMap();
|
||||
} = useSearchFetchMindMap();
|
||||
|
||||
const handleShowModal = useCallback(() => {
|
||||
const searchParams = { question: trim(question), kb_ids: kbIds };
|
||||
|
||||
Reference in New Issue
Block a user