mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-14 00:48:26 +08:00
### What problem does this PR solve? Feat: Modify the data structure of the chunk in the conversation #3909 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
import { useSetModalState, useTranslate } from '@/hooks/common-hooks';
|
|
import apiDoc from '@parent/docs/references/http_api_reference.md';
|
|
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
import { Button, Card, Flex, Space } from 'antd';
|
|
import ChatApiKeyModal from '../chat-api-key-modal';
|
|
import { usePreviewChat } from '../hooks';
|
|
import BackendServiceApi from './backend-service-api';
|
|
|
|
const ApiContent = ({
|
|
id,
|
|
idKey,
|
|
hideChatPreviewCard = false,
|
|
}: {
|
|
id?: string;
|
|
idKey: string;
|
|
hideChatPreviewCard?: boolean;
|
|
}) => {
|
|
const { t } = useTranslate('chat');
|
|
const {
|
|
visible: apiKeyVisible,
|
|
hideModal: hideApiKeyModal,
|
|
showModal: showApiKeyModal,
|
|
} = useSetModalState();
|
|
// const { embedVisible, hideEmbedModal, showEmbedModal, embedToken } =
|
|
// useShowEmbedModal(idKey);
|
|
|
|
const { handlePreview } = usePreviewChat(idKey);
|
|
|
|
return (
|
|
<div>
|
|
<Flex vertical gap={'middle'}>
|
|
<BackendServiceApi show={showApiKeyModal}></BackendServiceApi>
|
|
{!hideChatPreviewCard && (
|
|
<Card title={`${name} Web App`}>
|
|
<Flex gap={8} vertical>
|
|
<Space size={'middle'}>
|
|
<Button onClick={handlePreview}>{t('preview')}</Button>
|
|
{/* <Button onClick={() => showEmbedModal(id)}>
|
|
{t('embedded')}
|
|
</Button> */}
|
|
</Space>
|
|
</Flex>
|
|
</Card>
|
|
)}
|
|
<MarkdownPreview source={apiDoc}></MarkdownPreview>
|
|
</Flex>
|
|
{apiKeyVisible && (
|
|
<ChatApiKeyModal
|
|
hideModal={hideApiKeyModal}
|
|
dialogId={id}
|
|
idKey={idKey}
|
|
></ChatApiKeyModal>
|
|
)}
|
|
{/* {embedVisible && (
|
|
<EmbedModal
|
|
token={embedToken}
|
|
visible={embedVisible}
|
|
hideModal={hideEmbedModal}
|
|
></EmbedModal>
|
|
)} */}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ApiContent;
|