refactor: streamline handling of <details> tags in markdown parsing
- Updated the assistant message widget to rely on the markdown parser for <details> tags, eliminating manual tag management for tool_calls and reasoning types. - Enhanced the details builder to ensure proper handling of <details> elements during streaming, preventing character flashing. - Cleaned up the code by removing redundant comments and consolidating logic for improved readability and maintainability.
This commit is contained in:
@@ -763,9 +763,11 @@ class _DetailsBuilder extends MarkdownElementBuilder {
|
||||
|
||||
@override
|
||||
Widget? visitElementAfter(md.Element element, TextStyle? preferredStyle) {
|
||||
// The details element should not be rendered as markdown during streaming.
|
||||
// Instead, it's handled by the ReasoningParser in assistant_message_widget.
|
||||
// Return empty widget to prevent flashing.
|
||||
// Details elements with type="reasoning" or type="tool_calls" should not be
|
||||
// rendered as markdown during streaming. They are handled by:
|
||||
// - ReasoningParser for reasoning blocks (creates thinking tiles)
|
||||
// - ToolCallsParser for tool_calls blocks (creates tool execution tiles)
|
||||
// Return empty widget to prevent character flashing during streaming.
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user