| .. | .. |
|---|
| 13 | 13 | final String content; |
|---|
| 14 | 14 | final String? audioUri; |
|---|
| 15 | 15 | final String? imageBase64; |
|---|
| 16 | + final String? mimeType; |
|---|
| 16 | 17 | final int timestamp; |
|---|
| 17 | 18 | final MessageStatus? status; |
|---|
| 18 | 19 | final int? duration; |
|---|
| .. | .. |
|---|
| 25 | 26 | required this.timestamp, |
|---|
| 26 | 27 | this.audioUri, |
|---|
| 27 | 28 | this.imageBase64, |
|---|
| 29 | + this.mimeType, |
|---|
| 28 | 30 | this.status, |
|---|
| 29 | 31 | this.duration, |
|---|
| 30 | 32 | }); |
|---|
| .. | .. |
|---|
| 67 | 69 | required MessageRole role, |
|---|
| 68 | 70 | required String imageBase64, |
|---|
| 69 | 71 | String content = '', |
|---|
| 72 | + String? mimeType, |
|---|
| 70 | 73 | MessageStatus? status, |
|---|
| 71 | 74 | }) { |
|---|
| 72 | 75 | return Message( |
|---|
| .. | .. |
|---|
| 75 | 78 | type: MessageType.image, |
|---|
| 76 | 79 | content: content, |
|---|
| 77 | 80 | imageBase64: imageBase64, |
|---|
| 81 | + mimeType: mimeType, |
|---|
| 78 | 82 | timestamp: DateTime.now().millisecondsSinceEpoch, |
|---|
| 79 | 83 | status: status, |
|---|
| 80 | 84 | ); |
|---|
| .. | .. |
|---|
| 84 | 88 | String? content, |
|---|
| 85 | 89 | String? audioUri, |
|---|
| 86 | 90 | String? imageBase64, |
|---|
| 91 | + String? mimeType, |
|---|
| 87 | 92 | MessageStatus? status, |
|---|
| 88 | 93 | int? duration, |
|---|
| 89 | 94 | }) { |
|---|
| .. | .. |
|---|
| 94 | 99 | content: content ?? this.content, |
|---|
| 95 | 100 | audioUri: audioUri ?? this.audioUri, |
|---|
| 96 | 101 | imageBase64: imageBase64 ?? this.imageBase64, |
|---|
| 102 | + mimeType: mimeType ?? this.mimeType, |
|---|
| 97 | 103 | timestamp: timestamp, |
|---|
| 98 | 104 | status: status ?? this.status, |
|---|
| 99 | 105 | duration: duration ?? this.duration, |
|---|
| .. | .. |
|---|
| 108 | 114 | 'content': content, |
|---|
| 109 | 115 | if (audioUri != null) 'audioUri': audioUri, |
|---|
| 110 | 116 | if (imageBase64 != null) 'imageBase64': imageBase64, |
|---|
| 117 | + if (mimeType != null) 'mimeType': mimeType, |
|---|
| 111 | 118 | 'timestamp': timestamp, |
|---|
| 112 | 119 | if (status != null) 'status': status!.name, |
|---|
| 113 | 120 | if (duration != null) 'duration': duration, |
|---|
| .. | .. |
|---|
| 130 | 137 | if (duration != null) 'duration': duration, |
|---|
| 131 | 138 | // Keep imageBase64 — images are typically 50-200 KB and must survive restart. |
|---|
| 132 | 139 | if (imageBase64 != null) 'imageBase64': imageBase64, |
|---|
| 140 | + if (mimeType != null) 'mimeType': mimeType, |
|---|
| 133 | 141 | }; |
|---|
| 134 | 142 | } |
|---|
| 135 | 143 | |
|---|
| .. | .. |
|---|
| 141 | 149 | content: json['content'] as String? ?? '', |
|---|
| 142 | 150 | audioUri: json['audioUri'] as String?, |
|---|
| 143 | 151 | imageBase64: json['imageBase64'] as String?, |
|---|
| 152 | + mimeType: json['mimeType'] as String?, |
|---|
| 144 | 153 | timestamp: json['timestamp'] as int, |
|---|
| 145 | 154 | status: json['status'] != null |
|---|
| 146 | 155 | ? MessageStatus.values.byName(json['status'] as String) |
|---|