AgentMessage.fromJson constructor
Implementation
factory AgentMessage.fromJson(Map<String, dynamic> json) => AgentMessage(
id: json['id'] as String? ?? '',
fromId: json['fromId'] as String? ?? 'unknown',
toId: json['toId'] as String? ?? '',
text: json['text'] as String? ?? '',
sentAt: json['sentAt'] as String? ?? '',
hops: json['hops'] as int? ?? 0,
kind: switch (json['kind']) {
'user' => AgentMessageKind.user,
_ => AgentMessageKind.agent,
},
);