AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
refactor: Refactor agent message tile rendering logic
hunteraraujo2f187a853e7b
diff --git a/frontend/lib/views/chat/agent_message_tile.dart b/frontend/lib/views/chat/agent_message_tile.dartindex 851af1f06b..029f487c05 100644--- a/frontend/lib/views/chat/agent_message_tile.dart+++ b/frontend/lib/views/chat/agent_message_tile.dart@@ -34,8 +34,9 @@ class _AgentMessageTileState extends State<AgentMessageTile> {r'(?:\*|_).*?(?:\*|_)|' + // Italicr'\[.*?\]\(.*?\)|' + // Linksr'!\[.*?\]\(.*?\)|' + // Images- r'#{1,6}.*', // Headers- multiLine: true,+ r'#{1,6}.*|' + // Headers+ r'```.*?```', // Fenced code blocks+ dotAll: true, // To match across multiple linescaseSensitive: false,);@@ -80,10 +81,45 @@ class _AgentMessageTileState extends State<AgentMessageTile> {Expanded(child: Container(padding: const EdgeInsets.fromLTRB(0, 10, 20, 10),- child: false- ? Markdown(data: widget.chat.message)- : SelectableText(widget.chat.message,- maxLines: null),+ child: SingleChildScrollView(+ child: hasMarkdown+ ? Markdown(+ data: widget.chat.message,+ shrinkWrap: true,+ styleSheet: MarkdownStyleSheet.fromTheme(+ Theme.of(context))+ .copyWith(+ blockquoteDecoration: BoxDecoration(+ color: Colors+ .black, // Background color for blockquotes+ border: Border(+ left: BorderSide(+ color: Colors.grey,+ width: 4.0,+ ),+ ),+ ),+ blockquoteAlign: WrapAlignment.start,+ blockquotePadding: const EdgeInsets.all(+ 10.0), // Padding for blockquotes+ codeblockDecoration: BoxDecoration(+ color: Colors.grey[+ 200], // Background color for code blocks+ borderRadius:+ BorderRadius.circular(4.0),+ ),+ codeblockPadding: const EdgeInsets.all(+ 10.0), // Padding for code blocks+ code: TextStyle(+ backgroundColor: Colors.grey[+ 200], // Background color for inline code+ fontFamily: 'monospace',+ ),+ ),+ )+ : SelectableText(widget.chat.message,+ maxLines: null),+ ),),),ElevatedButton(