1
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#import "KBCommentModel.h"
|
||||
#import "KBLikedCompanionModel.h"
|
||||
#import "KBChattedCompanionModel.h"
|
||||
#import "KBChatSessionResetModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -154,6 +155,14 @@ typedef void (^AiVMSpeechTranscribeCompletion)(KBAiSpeechTranscribeResponse *_Nu
|
||||
/// @param completion 完成回调(返回聊天角色数组)
|
||||
- (void)fetchChattedCompanionsWithCompletion:(void(^)(NSArray<KBChattedCompanionModel *> * _Nullable list, NSError * _Nullable error))completion;
|
||||
|
||||
#pragma mark - 会话管理接口
|
||||
|
||||
/// 重置会话(将当前会话设为不活跃并创建新会话)
|
||||
/// @param companionId AI 角色 ID
|
||||
/// @param completion 完成回调(返回新会话信息)
|
||||
- (void)resetChatSessionWithCompanionId:(NSInteger)companionId
|
||||
completion:(void(^)(KBChatSessionResetResponse * _Nullable response, NSError * _Nullable error))completion;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#import "KBCommentModel.h"
|
||||
#import "KBLikedCompanionModel.h"
|
||||
#import "KBChattedCompanionModel.h"
|
||||
#import "KBChatSessionResetModel.h"
|
||||
#import <MJExtension/MJExtension.h>
|
||||
|
||||
@implementation KBAiSyncData
|
||||
@@ -691,4 +692,38 @@ autoShowBusinessError:NO
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 会话管理接口
|
||||
|
||||
- (void)resetChatSessionWithCompanionId:(NSInteger)companionId
|
||||
completion:(void (^)(KBChatSessionResetResponse * _Nullable, NSError * _Nullable))completion {
|
||||
NSDictionary *params = @{
|
||||
@"companionId": @(companionId)
|
||||
};
|
||||
|
||||
NSLog(@"[AiVM] /chat/session/reset request: %@", params);
|
||||
[[KBNetworkManager shared]
|
||||
POST:@"/chat/session/reset"
|
||||
jsonBody:params
|
||||
headers:nil
|
||||
autoShowBusinessError:NO
|
||||
completion:^(NSDictionary *_Nullable json,
|
||||
NSURLResponse *_Nullable response,
|
||||
NSError *_Nullable error) {
|
||||
if (error) {
|
||||
NSLog(@"[AiVM] /chat/session/reset failed: %@", error.localizedDescription ?: @"");
|
||||
if (completion) {
|
||||
completion(nil, error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog(@"[AiVM] /chat/session/reset response: %@", json);
|
||||
|
||||
KBChatSessionResetResponse *resetResponse = [KBChatSessionResetResponse mj_objectWithKeyValues:json];
|
||||
if (completion) {
|
||||
completion(resetResponse, nil);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user