ChatMessage constructor
ChatMessage({
- required MessageOrigin origin,
- required String? text,
- required Iterable<
Attachment> attachments, - String? thinking,
Constructs a ChatMessage instance.
The origin parameter specifies the origin of the message (user or LLM).
The text parameter is the content of the message. It can be null or
empty if the message is from an LLM. For user-originated messages, text
must not be null or empty. The attachments parameter is a list of any
files or media attached to the message.
Implementation
ChatMessage({
required this.origin,
required String? text,
required this.attachments,
this._thinking,
}) : assert(origin.isUser && text != null && text.isNotEmpty || origin.isLlm),
_text = text;