Archer 9501c3f3a1
V4.7-alpha (#985)
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
2024-03-13 10:50:02 +08:00

50 lines
1.2 KiB
TypeScript

import React from 'react';
import { ModalBody, Box, useTheme } from '@chakra-ui/react';
import MyModal from '../MyModal';
import { DispatchNodeResponseType } from '@fastgpt/global/core/module/runtime/type.d';
const ContextModal = ({
context = [],
onClose
}: {
context: DispatchNodeResponseType['historyPreview'];
onClose: () => void;
}) => {
const theme = useTheme();
return (
<MyModal
isOpen={true}
onClose={onClose}
iconSrc="/imgs/modal/chatHistory.svg"
title={`上下文预览(${context.length}条)`}
h={['90vh', '80vh']}
minW={['90vw', '600px']}
isCentered
>
<ModalBody
whiteSpace={'pre-wrap'}
textAlign={'justify'}
wordBreak={'break-all'}
fontSize={'sm'}
>
{context.map((item, i) => (
<Box
key={i}
p={2}
borderRadius={'md'}
border={theme.borders.base}
_notLast={{ mb: 2 }}
position={'relative'}
>
<Box fontWeight={'bold'}>{item.obj}</Box>
<Box>{item.value}</Box>
</Box>
))}
</ModalBody>
</MyModal>
);
};
export default ContextModal;