feat: enhance markdown image handling with customizable builder

- Introduced an `imageBuilderOverride` parameter in the `ConduitMarkdown` class to allow customization of how markdown images are rendered.
- Updated the `StreamingMarkdownWidget` to accept the new `imageBuilderOverride` parameter, enabling enhanced image handling in streaming contexts.
- Implemented an `imageBuilderOverride` in the `_AssistantMessageWidgetState` to utilize `EnhancedImageAttachment`, providing caching, authentication headers, and fullscreen viewing for markdown images.
- Refactored the `_ImageBuilder` class to support the new image building logic, improving flexibility and maintainability of image rendering in markdown content.
This commit is contained in:
cogwheel0
2025-10-10 16:12:31 +05:30
parent e73c5ee93a
commit 570fa26011
3 changed files with 28 additions and 6 deletions

View File

@@ -13,11 +13,14 @@ class StreamingMarkdownWidget extends StatelessWidget {
required this.content,
required this.isStreaming,
this.onTapLink,
this.imageBuilderOverride,
});
final String content;
final bool isStreaming;
final MarkdownLinkTapCallback? onTapLink;
final Widget Function(Uri uri, String? title, String? alt)?
imageBuilderOverride;
@override
Widget build(BuildContext context) {
@@ -34,6 +37,7 @@ class StreamingMarkdownWidget extends StatelessWidget {
data: data,
onTapLink: onTapLink,
selectable: false,
imageBuilderOverride: imageBuilderOverride,
);
}