mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-29 20:19:24 +08:00
### What problem does this PR solve? - Unify top level pages structure - Standardize locale language codes (BCP 47) and time zones (IANA tz) > **Note:** > Newly created user info brings non-standard default values `timezone: "UTC+8\tAsia/Shanghai"` and `language: "English"`. ### Type of change - [x] Refactoring
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import { useIsDarkTheme } from '@/components/theme-provider';
|
|
import { Button } from '@/components/ui/button';
|
|
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
|
import { LangfuseCard } from '@/pages/user-setting/setting-model/langfuse';
|
|
import apiDoc from '@parent/docs/references/http_api_reference.md?raw';
|
|
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
import ChatApiKeyModal from '../chat-api-key-modal';
|
|
import BackendServiceApi from './backend-service-api';
|
|
import MarkdownToc from './markdown-toc';
|
|
|
|
const ApiContent = ({ id, idKey }: { id?: string; idKey: string }) => {
|
|
const { t } = useTranslate('setting');
|
|
|
|
const {
|
|
visible: apiKeyVisible,
|
|
hideModal: hideApiKeyModal,
|
|
showModal: showApiKeyModal,
|
|
} = useSetModalState();
|
|
|
|
const {
|
|
visible: tocVisible,
|
|
hideModal: hideToc,
|
|
showModal: showToc,
|
|
} = useSetModalState();
|
|
|
|
const isDarkTheme = useIsDarkTheme();
|
|
|
|
return (
|
|
<div className="flex flex-col w-full">
|
|
<BackendServiceApi show={showApiKeyModal} />
|
|
|
|
<div className="text-left py-4">
|
|
<Button onClick={tocVisible ? hideToc : showToc}>
|
|
{tocVisible ? t('hideToc') : t('showToc')}
|
|
</Button>
|
|
</div>
|
|
<section className="flex flex-col gap-2 pb-5 flex-1 min-h-0 overflow-auto mb-4">
|
|
<div style={{ position: 'relative' }}>
|
|
{tocVisible && <MarkdownToc content={apiDoc} />}
|
|
</div>
|
|
<MarkdownPreview
|
|
source={apiDoc}
|
|
wrapperElement={{ 'data-color-mode': isDarkTheme ? 'dark' : 'light' }}
|
|
></MarkdownPreview>
|
|
</section>
|
|
<LangfuseCard></LangfuseCard>
|
|
{apiKeyVisible && (
|
|
<ChatApiKeyModal
|
|
hideModal={hideApiKeyModal}
|
|
dialogId={id}
|
|
idKey={idKey}
|
|
></ChatApiKeyModal>
|
|
)}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ApiContent;
|