RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
/*
* Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Button } from '@/components/ui/button';
import { useFetchUserInfo } from '@/hooks/use-user-setting-request';
import { Settings } from 'lucide-react';
import { useEffect, useState } from 'react';
import {
ISearchAppDetailProps,
useFetchSearchDetail,
} from '../next-searches/hooks';
import { useCheckSettings } from './hooks';
import './index.less';
import SearchHome from './search-home';
import { SearchSetting } from './search-setting';
import SearchingPage from './searching';
export default function SearchPage() {
const [isSearching, setIsSearching] = useState(false);
const { data: SearchData } = useFetchSearchDetail();
const [openSetting, setOpenSetting] = useState(false);
const [searchText, setSearchText] = useState('');
const { data: userInfo } = useFetchUserInfo();
const { openSetting: checkOpenSetting } = useCheckSettings(
SearchData as ISearchAppDetailProps,
);
useEffect(() => {
setOpenSetting(checkOpenSetting);
}, [checkOpenSetting]);
useEffect(() => {
if (isSearching) {
setOpenSetting(false);
}
}, [isSearching]);
return (
<section
className="size-full flex-1 relative px-5 pb-5 flex pt-4"
data-testid="search-detail"
>
<div className="flex gap-3 flex-1 min-w-0 bg-bg-base border-0.5 border-border-button">
<div className="flex-1 min-w-0 overflow-hidden">
{!isSearching && (
<div className="animate-fade-in-down h-full overflow-x-hidden overflow-y-auto">
<SearchHome
setIsSearching={setIsSearching}
isSearching={isSearching}
searchText={searchText}
setSearchText={setSearchText}
userInfo={userInfo}
canSearch={!checkOpenSetting}
/>
</div>
)}
{isSearching && (
<div className="animate-fade-in-up h-full">
<SearchingPage
setIsSearching={setIsSearching}
searchText={searchText}
setSearchText={setSearchText}
data={SearchData as ISearchAppDetailProps}
/>
</div>
)}
</div>
{openSetting && (
<SearchSetting
open={openSetting}
setOpen={setOpenSetting}
className="shrink-0 max-w-full"
data={SearchData as ISearchAppDetailProps}
/>
)}
</div>
<Button
variant="transparent"
className="bg-bg-card ml-5 shrink-0"
onClick={() => setOpenSetting(!openSetting)}
>
<Settings className="text-text-secondary" />
</Button>
</section>
);
}