toMap method
Converts the message to a standardized JSON map for Isolate/Cloud transfer.
Implementation
Map<String, dynamic> toMap() {
return {
'role': role.name,
'content': content,
if (toolCalls != null) 'tool_calls': toolCalls,
if (toolCallId != null) 'tool_call_id': toolCallId,
'is_summary': isSummary,
'timestamp': timestamp.toIso8601String(),
if (metadata != null) 'metadata': metadata,
};
}