Disable markdown as it causes crash for some responses
parent
2187f66149
commit
82434a248c
|
@ -28,14 +28,13 @@ class _AgentMessageTileState extends State<AgentMessageTile> {
|
||||||
int artifactsCount = widget.chat.artifacts.length;
|
int artifactsCount = widget.chat.artifacts.length;
|
||||||
|
|
||||||
bool containsMarkdown(String text) {
|
bool containsMarkdown(String text) {
|
||||||
// Regular expression to detect Markdown patterns including code blocks.
|
// Regular expression to detect Markdown patterns like headers, bold, links, etc.
|
||||||
final RegExp markdownPattern = RegExp(
|
final RegExp markdownPattern = RegExp(
|
||||||
r'(?:\*\*|__).*?(?:\*\*|__)|' + // Bold
|
r'(?:\*\*|__).*?(?:\*\*|__)|' + // Bold
|
||||||
r'(?:\*|_).*?(?:\*|_)|' + // Italic
|
r'(?:\*|_).*?(?:\*|_)|' + // Italic
|
||||||
r'\[.*?\]\(.*?\)|' + // Links
|
r'\[.*?\]\(.*?\)|' + // Links
|
||||||
r'!\[.*?\]\(.*?\)|' + // Images
|
r'!\[.*?\]\(.*?\)|' + // Images
|
||||||
r'#{1,6}.*|' + // Headers
|
r'#{1,6}.*', // Headers
|
||||||
r'`.*?`', // Inline Code Blocks
|
|
||||||
multiLine: true,
|
multiLine: true,
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
);
|
);
|
||||||
|
@ -81,9 +80,10 @@ class _AgentMessageTileState extends State<AgentMessageTile> {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.fromLTRB(0, 10, 20, 10),
|
padding: const EdgeInsets.fromLTRB(0, 10, 20, 10),
|
||||||
child: hasMarkdown
|
child: false
|
||||||
? Markdown(data: widget.chat.message)
|
? Markdown(data: widget.chat.message)
|
||||||
: Text(widget.chat.message, maxLines: null),
|
: SelectableText(widget.chat.message,
|
||||||
|
maxLines: null),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
|
|
@ -54,7 +54,7 @@ class UserMessageTile extends StatelessWidget {
|
||||||
// Padding for the text content
|
// Padding for the text content
|
||||||
padding: const EdgeInsets.fromLTRB(0, 10, 20, 10),
|
padding: const EdgeInsets.fromLTRB(0, 10, 20, 10),
|
||||||
// Displaying the user message with no max line limit
|
// Displaying the user message with no max line limit
|
||||||
child: Text(
|
child: SelectableText(
|
||||||
message,
|
message,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue