- Added `markdown` dependency version `^7.2.1` in `pubspec.yaml`. - Updated `pubspec.lock` to reflect the direct dependency change. - Refactored `streaming_helper.dart` to utilize `StreamingResponseController` for better stream management. - Enhanced `ChatMessagesNotifier` to handle message streams with improved formatting and error handling. - Updated `StreamingMarkdownWidget` to streamline markdown rendering and support new configurations.
26 lines
669 B
Dart
26 lines
669 B
Dart
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import '../../../core/models/chat_message.dart';
|
|
|
|
typedef AssistantResponseBuilder =
|
|
Widget Function(BuildContext context, AssistantResponseContext response);
|
|
|
|
class AssistantResponseContext {
|
|
const AssistantResponseContext({
|
|
required this.message,
|
|
required this.markdown,
|
|
required this.isStreaming,
|
|
required this.buildDefault,
|
|
});
|
|
|
|
final ChatMessage message;
|
|
final String markdown;
|
|
final bool isStreaming;
|
|
final WidgetBuilder buildDefault;
|
|
}
|
|
|
|
final assistantResponseBuilderProvider = Provider<AssistantResponseBuilder?>(
|
|
(_) => null,
|
|
);
|