新增聊天记录
This commit is contained in:
43
keyBoard/Class/AiTalk/M/KBChatHistoryModel.m
Normal file
43
keyBoard/Class/AiTalk/M/KBChatHistoryModel.m
Normal file
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// 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
|
||||
Reference in New Issue
Block a user