44 lines
749 B
Objective-C
44 lines
749 B
Objective-C
//
|
|
// KBChatHistoryModel.m
|
|
// keyBoard
|
|
//
|
|
// Created by Kiro on 2026/1/26.
|
|
//
|
|
|
|
#import "KBChatHistoryModel.h"
|
|
#import <MJExtension/MJExtension.h>
|
|
|
|
@implementation KBChatHistoryModel
|
|
|
|
#pragma mark - MJExtension 配置
|
|
|
|
// 字段映射
|
|
+ (NSDictionary *)mj_replacedKeyFromPropertyName {
|
|
return @{
|
|
@"messageId": @"id"
|
|
};
|
|
}
|
|
|
|
// 转换完成后的处理
|
|
- (void)mj_keyValuesDidFinishConvertingToObject {
|
|
// 容错处理
|
|
if (!self.content) {
|
|
self.content = @"";
|
|
}
|
|
if (!self.createdAt) {
|
|
self.createdAt = @"";
|
|
}
|
|
}
|
|
|
|
#pragma mark - 扩展属性
|
|
|
|
- (BOOL)isUserMessage {
|
|
return self.sender == KBChatSenderUser;
|
|
}
|
|
|
|
- (BOOL)isAssistantMessage {
|
|
return self.sender == KBChatSenderAssistant;
|
|
}
|
|
|
|
@end
|