新增接口
This commit is contained in:
@@ -111,6 +111,12 @@ typedef void (^AiVMSpeechTranscribeCompletion)(KBAiSpeechTranscribeResponse *_Nu
|
|||||||
pageSize:(NSInteger)pageSize
|
pageSize:(NSInteger)pageSize
|
||||||
completion:(void(^)(KBChatHistoryPageModel * _Nullable pageModel, NSError * _Nullable error))completion;
|
completion:(void(^)(KBChatHistoryPageModel * _Nullable pageModel, NSError * _Nullable error))completion;
|
||||||
|
|
||||||
|
/// 删除聊天记录(根据聊天记录 ID 逻辑删除聊天消息)
|
||||||
|
/// @param historyId 聊天记录 ID(接口字段为 id)
|
||||||
|
/// @param completion 完成回调
|
||||||
|
- (void)deleteChatHistoryWithId:(NSInteger)historyId
|
||||||
|
completion:(void(^)(BOOL success, NSError * _Nullable error))completion;
|
||||||
|
|
||||||
#pragma mark - 评论相关接口
|
#pragma mark - 评论相关接口
|
||||||
|
|
||||||
/// 发表评论
|
/// 发表评论
|
||||||
|
|||||||
@@ -426,6 +426,68 @@ autoShowBusinessError:NO
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)deleteChatHistoryWithId:(NSInteger)historyId
|
||||||
|
completion:(void (^)(BOOL, NSError * _Nullable))completion {
|
||||||
|
if (historyId <= 0) {
|
||||||
|
NSError *error = [NSError errorWithDomain:@"AiVM"
|
||||||
|
code:-1
|
||||||
|
userInfo:@{NSLocalizedDescriptionKey : @"invalid historyId"}];
|
||||||
|
if (completion) {
|
||||||
|
completion(NO, error);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSDictionary *params = @{
|
||||||
|
@"id": @(historyId)
|
||||||
|
};
|
||||||
|
|
||||||
|
NSLog(@"[AiVM] /chat/history/delete request: %@", params);
|
||||||
|
[[KBNetworkManager shared]
|
||||||
|
POST:@"/chat/history/delete"
|
||||||
|
jsonBody:params
|
||||||
|
headers:nil
|
||||||
|
autoShowBusinessError:NO
|
||||||
|
completion:^(NSDictionary *_Nullable json,
|
||||||
|
NSURLResponse *_Nullable response,
|
||||||
|
NSError *_Nullable error) {
|
||||||
|
if (error) {
|
||||||
|
NSLog(@"[AiVM] /chat/history/delete failed: %@", error.localizedDescription ?: @"");
|
||||||
|
if (completion) {
|
||||||
|
completion(NO, error);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSLog(@"[AiVM] /chat/history/delete response: %@", json);
|
||||||
|
if (![json isKindOfClass:[NSDictionary class]]) {
|
||||||
|
NSError *parseError = [NSError errorWithDomain:@"AiVM"
|
||||||
|
code:-1
|
||||||
|
userInfo:@{NSLocalizedDescriptionKey : @"数据格式错误"}];
|
||||||
|
if (completion) {
|
||||||
|
completion(NO, parseError);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSInteger code = [json[@"code"] integerValue];
|
||||||
|
if (code != 0) {
|
||||||
|
NSString *message = json[@"message"] ?: @"请求失败";
|
||||||
|
NSError *bizError = [NSError errorWithDomain:@"AiVM"
|
||||||
|
code:code
|
||||||
|
userInfo:@{NSLocalizedDescriptionKey : message}];
|
||||||
|
if (completion) {
|
||||||
|
completion(NO, bizError);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (completion) {
|
||||||
|
completion(YES, nil);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - 评论相关接口
|
#pragma mark - 评论相关接口
|
||||||
|
|
||||||
- (void)addCommentWithCompanionId:(NSInteger)companionId
|
- (void)addCommentWithCompanionId:(NSInteger)companionId
|
||||||
|
|||||||
Reference in New Issue
Block a user