Check for inline code blocks in agent step

pull/5827/head^2
hunteraraujo 2023-10-20 00:15:20 -07:00
parent 952f181377
commit 27ff99a9a5
1 changed files with 3 additions and 2 deletions

View File

@ -28,13 +28,14 @@ class _AgentMessageTileState extends State<AgentMessageTile> {
int artifactsCount = widget.chat.artifacts.length;
bool containsMarkdown(String text) {
// Regular expression to detect Markdown patterns like headers, bold, links, etc.
// Regular expression to detect Markdown patterns including code blocks.
final RegExp markdownPattern = RegExp(
r'(?:\*\*|__).*?(?:\*\*|__)|' + // Bold
r'(?:\*|_).*?(?:\*|_)|' + // Italic
r'\[.*?\]\(.*?\)|' + // Links
r'!\[.*?\]\(.*?\)|' + // Images
r'#{1,6}.*', // Headers
r'#{1,6}.*|' + // Headers
r'`.*?`', // Inline Code Blocks
multiLine: true,
caseSensitive: false,
);