fromJsonThread static method
Implementation
static MessageZhipuAI fromJsonThread(dynamic json) {
//
List<Category> categoriesList = [];
if (json['type'] == BytedeskConstants.MESSAGE_TYPE_ROBOT_WELCOME) {
categoriesList = json['categories'] == null
? []
: (json['categories'] as List<dynamic>)
.map((item) => Category.fromJson(item))
.toList();
}
//
MessageZhipuAI messageZhipuAI = MessageZhipuAI(
mid: json['mid'],
content: json['content'],
imageUrl: json['imageUrl'],
voiceUrl: json['voiceUrl'],
fileUrl: json['fileUrl'],
videoUrl: json['videoOrShortUrl'],
nickname: json['user']['nickname'],
avatar: json['user']['avatar'],
type: json['type'],
timestamp: json['createdAt'],
status: 'stored',
isSend: 0,
currentUid: SpUtil.getString(BytedeskConstants.uid),
client: json['client'],
thread: ThreadZhipuAI.fromVisitorJson(json['thread']),
user: User.fromJson(json['user']),
categories: categoriesList,
categoriesJson: json['categories'].toString()
// answers: robotQaList,
// answersJson: json['answers'].toString()
);
if (messageZhipuAI.currentUid == messageZhipuAI.user!.uid) {
messageZhipuAI.isSend = 1;
}
return messageZhipuAI;
}