feat: Make agent template support HTML #1842 (#2259)

### What problem does this PR solve?

feat: Make agent template support HTML #1842
### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu 2024-09-05 10:49:52 +08:00 committed by GitHub
parent 6df0f44e71
commit 7c98cb5075
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@ import { useCallback, useState } from 'react';
import CreateAgentModal from './create-agent-modal';
import GraphAvatar from './graph-avatar';
import DOMPurify from 'dompurify';
import styles from './index.less';
const { Title, Text, Paragraph } = Typography;
@ -83,7 +84,11 @@ const AgentTemplateModal = ({ visible, hideModal, loading, onOk }: IProps) => {
</Flex>
<div className={styles.agentDescription}>
<Paragraph ellipsis={{ tooltip: x.description, rows: 5 }}>
{x.description}
<div
dangerouslySetInnerHTML={{
__html: DOMPurify.sanitize(x.description),
}}
></div>
</Paragraph>
</div>
{selectedId === x.id && (