From 27ff99a9a5da63e04a73a4e0de0f42fd05a616b2 Mon Sep 17 00:00:00 2001 From: hunteraraujo Date: Fri, 20 Oct 2023 00:15:20 -0700 Subject: [PATCH] Check for inline code blocks in agent step --- frontend/lib/views/chat/agent_message_tile.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/lib/views/chat/agent_message_tile.dart b/frontend/lib/views/chat/agent_message_tile.dart index 91226f71c..4639b76bd 100644 --- a/frontend/lib/views/chat/agent_message_tile.dart +++ b/frontend/lib/views/chat/agent_message_tile.dart @@ -28,13 +28,14 @@ class _AgentMessageTileState extends State { 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, );