mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-31 09:05:30 +08:00
### What problem does this PR solve? Feat: Adapt the theme of the documentation page. #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
import { useIsDarkTheme } from '@/components/theme-provider';
|
||||||
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
||||||
import { LangfuseCard } from '@/pages/user-setting/setting-model/langfuse';
|
import { LangfuseCard } from '@/pages/user-setting/setting-model/langfuse';
|
||||||
import apiDoc from '@parent/docs/references/http_api_reference.md';
|
import apiDoc from '@parent/docs/references/http_api_reference.md';
|
||||||
@ -28,6 +29,8 @@ const ApiContent = ({
|
|||||||
|
|
||||||
const { handlePreview } = usePreviewChat(idKey);
|
const { handlePreview } = usePreviewChat(idKey);
|
||||||
|
|
||||||
|
const isDarkTheme = useIsDarkTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="pb-2">
|
<div className="pb-2">
|
||||||
<Flex vertical gap={'middle'}>
|
<Flex vertical gap={'middle'}>
|
||||||
@ -47,7 +50,10 @@ const ApiContent = ({
|
|||||||
<div style={{ position: 'relative' }}>
|
<div style={{ position: 'relative' }}>
|
||||||
<MarkdownToc content={apiDoc} />
|
<MarkdownToc content={apiDoc} />
|
||||||
</div>
|
</div>
|
||||||
<MarkdownPreview source={apiDoc}></MarkdownPreview>
|
<MarkdownPreview
|
||||||
|
source={apiDoc}
|
||||||
|
wrapperElement={{ 'data-color-mode': isDarkTheme ? 'dark' : 'light' }}
|
||||||
|
></MarkdownPreview>
|
||||||
</Flex>
|
</Flex>
|
||||||
{apiKeyVisible && (
|
{apiKeyVisible && (
|
||||||
<ChatApiKeyModal
|
<ChatApiKeyModal
|
||||||
|
|||||||
@ -1,35 +1,19 @@
|
|||||||
import { toast } from 'sonner';
|
import { ExternalToast, toast } from 'sonner';
|
||||||
|
|
||||||
const duration = { duration: 2500 };
|
const configuration: ExternalToast = { duration: 2500, position: 'top-center' };
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
success: (msg: string) => {
|
success: (msg: string) => {
|
||||||
toast.success(msg, {
|
toast.success(msg, configuration);
|
||||||
position: 'top-center',
|
|
||||||
closeButton: false,
|
|
||||||
...duration,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
error: (msg: string) => {
|
error: (msg: string) => {
|
||||||
toast.error(msg, {
|
toast.error(msg, configuration);
|
||||||
position: 'top-center',
|
|
||||||
closeButton: false,
|
|
||||||
...duration,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
warning: (msg: string) => {
|
warning: (msg: string) => {
|
||||||
toast.warning(msg, {
|
toast.warning(msg, configuration);
|
||||||
position: 'top-center',
|
|
||||||
closeButton: false,
|
|
||||||
...duration,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
info: (msg: string) => {
|
info: (msg: string) => {
|
||||||
toast.info(msg, {
|
toast.info(msg, configuration);
|
||||||
position: 'top-center',
|
|
||||||
closeButton: false,
|
|
||||||
...duration,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
export default message;
|
export default message;
|
||||||
|
|||||||
Reference in New Issue
Block a user