fix: show error messages as system and keep them in the message input (#319)
This commit is contained in:
@@ -2082,6 +2082,9 @@ class MessageInputState extends State<MessageInput> {
|
||||
}
|
||||
|
||||
return sendingFuture.then((resp) {
|
||||
if (resp.message?.type == 'error') {
|
||||
_parseExistingMessage(message);
|
||||
}
|
||||
if (widget.onMessageSent != null) {
|
||||
widget.onMessageSent(resp.message);
|
||||
}
|
||||
|
||||
@@ -847,7 +847,8 @@ class _MessageListViewState extends State<MessageListView> {
|
||||
List<Message> messages,
|
||||
int index,
|
||||
) {
|
||||
if (message.type == 'system' && message.text?.isNotEmpty == true) {
|
||||
if ((message.type == 'system' || message.type == 'error') &&
|
||||
message.text?.isNotEmpty == true) {
|
||||
return widget.systemMessageBuilder?.call(context, message) ??
|
||||
SystemMessage(
|
||||
key: ValueKey<String>('MESSAGE-${message.id}'),
|
||||
|
||||
Reference in New Issue
Block a user