copyWith method
- AIRole? role,
- String? content,
- List<
AIAttachment> ? attachments, - Map<
String, dynamic> ? metadata, - List<
AIToolCall> ? toolCalls, - String? toolCallId,
Creates a copy with modified fields.
Implementation
AIMessage copyWith({
AIRole? role,
String? content,
List<AIAttachment>? attachments,
Map<String, dynamic>? metadata,
List<AIToolCall>? toolCalls,
String? toolCallId,
}) {
return AIMessage(
role: role ?? this.role,
content: content ?? this.content,
attachments: attachments ?? this.attachments,
metadata: metadata ?? this.metadata,
toolCalls: toolCalls ?? this.toolCalls,
toolCallId: toolCallId ?? this.toolCallId,
timestamp: timestamp,
id: id,
);
}