mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-05 18:33:52 +00:00
Co-authored-by: Fangyin Cheng <staneyffer@gmail.com> Co-authored-by: 谨欣 <echo.cmy@antgroup.com> Co-authored-by: 严志勇 <yanzhiyong@tiansuixiansheng.com> Co-authored-by: yanzhiyong <932374019@qq.com>
24 lines
683 B
TypeScript
24 lines
683 B
TypeScript
import React, { memo, useContext, useMemo } from 'react';
|
|
import { MobileChatContext } from '../';
|
|
import ChatDialog from './ChatDialog';
|
|
|
|
const Content: React.FC = () => {
|
|
const { history } = useContext(MobileChatContext);
|
|
|
|
// 过滤出需要展示的消息
|
|
const showMessages = useMemo(() => {
|
|
return history.filter(item => ['view', 'human'].includes(item.role));
|
|
}, [history]);
|
|
|
|
return (
|
|
<div className='flex flex-col gap-4'>
|
|
{!!showMessages.length &&
|
|
showMessages.map((message, index) => {
|
|
return <ChatDialog key={message.context + index} message={message} index={index} />;
|
|
})}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default memo(Content);
|