mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-26 04:32:50 +00:00
Some checks are pending
Document deploy / generate-timestamp (push) Waiting to run
Document deploy / build-images (map[domain:https://fastgpt.cn suffix:cn]) (push) Blocked by required conditions
Document deploy / build-images (map[domain:https://fastgpt.io suffix:io]) (push) Blocked by required conditions
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.cn kube_config:KUBE_CONFIG_CN suffix:cn]) (push) Blocked by required conditions
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.io kube_config:KUBE_CONFIG_IO suffix:io]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / get-vars (push) Waiting to run
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:amd64 runs-on:ubuntu-24.04]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / release-fastgpt-images (push) Blocked by required conditions
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
'use client';
|
|
// components/CustomSearchDialog.tsx
|
|
import { liteClient } from 'algoliasearch/lite';
|
|
import { useDocsSearch } from 'fumadocs-core/search/client';
|
|
import {
|
|
SearchDialog,
|
|
SearchDialogOverlay,
|
|
SearchDialogContent,
|
|
SearchDialogHeader,
|
|
SearchDialogIcon,
|
|
SearchDialogInput,
|
|
SearchDialogClose,
|
|
SearchDialogList,
|
|
type SharedProps
|
|
} from 'fumadocs-ui/components/dialog/search';
|
|
import { useI18n } from 'fumadocs-ui/contexts/i18n';
|
|
|
|
if (!process.env.NEXT_PUBLIC_SEARCH_APPID || !process.env.NEXT_PUBLIC_SEARCH_APPKEY) {
|
|
throw new Error('NEXT_PUBLIC_SEARCH_APPID and NEXT_PUBLIC_SEARCH_APPKEY are not set');
|
|
}
|
|
|
|
const client = liteClient(
|
|
process.env.NEXT_PUBLIC_SEARCH_APPID,
|
|
process.env.NEXT_PUBLIC_SEARCH_APPKEY
|
|
);
|
|
|
|
export default function CustomSearchDialog(props: SharedProps) {
|
|
const { locale } = useI18n();
|
|
const { search, setSearch, query } = useDocsSearch({
|
|
type: 'algolia',
|
|
client,
|
|
indexName: 'document',
|
|
locale
|
|
});
|
|
|
|
return (
|
|
<SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
|
|
<SearchDialogOverlay />
|
|
<SearchDialogContent>
|
|
<SearchDialogHeader>
|
|
<SearchDialogIcon />
|
|
<SearchDialogInput />
|
|
<SearchDialogClose />
|
|
</SearchDialogHeader>
|
|
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
|
|
</SearchDialogContent>
|
|
</SearchDialog>
|
|
);
|
|
}
|