import { EntityInfoType, ChatContextType } from '../../../common/type'; import { PREFIX_CLS } from '../../../common/constants'; type Props = { position: 'left' | 'right'; width?: number | string; maxWidth?: number | string; height?: number | string; title?: string; followQuestions?: string[]; bubbleClassName?: string; chatContext?: ChatContextType; entityInfo?: EntityInfoType; children?: React.ReactNode; isMobileMode?: boolean; queryMode?: string; }; const Message: React.FC = ({ width, maxWidth, height, children, bubbleClassName, entityInfo, queryMode, chatContext, }) => { const prefixCls = `${PREFIX_CLS}-message`; const { modelName, dateInfo, dimensionFilters } = chatContext || {}; const { startDate, endDate } = dateInfo || {}; const entityInfoList = entityInfo?.dimensions?.filter(dimension => !dimension.bizName.includes('photo')) || []; return (
{ e.stopPropagation(); }} > {(queryMode === 'METRIC_ENTITY' || queryMode === 'ENTITY_DETAIL') && entityInfoList.length > 0 && (
{entityInfoList.slice(0, 4).map(dimension => { return (
{dimension.name}:
{dimension.bizName.includes('photo') ? ( ) : (
{dimension.value}
)}
); })}
)} {queryMode === 'ENTITY_LIST_FILTER' && (
数据模型:
{modelName}
时间:
{startDate === endDate ? startDate : `${startDate} ~ ${endDate}`}
{dimensionFilters && dimensionFilters?.length > 0 && (
筛选条件:
{dimensionFilters.map((filter, index) => (
{filter.name}: {Array.isArray(filter.value) ? filter.value.join('、') : filter.value} {index !== dimensionFilters.length - 1 && }
))}
)}
)}
{children}
); }; export default Message;