Files
keyboard/keyBoard/Class/AiTalk/VM/AiVM.h

83 lines
2.8 KiB
C
Raw Normal View History

2026-01-22 13:47:34 +08:00
//
// AiVM.h
// keyBoard
//
// Created by Mac on 2026/1/22.
//
#import <Foundation/Foundation.h>
2026-01-26 16:53:41 +08:00
#import "KBPersonaPageModel.h"
2026-01-26 18:17:02 +08:00
#import "KBChatHistoryPageModel.h"
2026-01-22 13:47:34 +08:00
NS_ASSUME_NONNULL_BEGIN
2026-01-22 22:03:56 +08:00
@interface KBAiSyncData : NSObject
@property(nonatomic, copy, nullable) NSString *aiResponse;
@property(nonatomic, copy, nullable) NSString *audioBase64;
@property(nonatomic, strong, nullable) NSData *audioData;
@end
@interface KBAiSyncResponse : NSObject
@property(nonatomic, assign) NSInteger code;
@property(nonatomic, strong, nullable) KBAiSyncData *data;
@end
typedef void (^AiVMSyncCompletion)(KBAiSyncResponse *_Nullable response,
NSError *_Nullable error);
@interface KBAiMessageData : NSObject
@property(nonatomic, copy, nullable) NSString *content;
@property(nonatomic, copy, nullable) NSString *text;
@property(nonatomic, copy, nullable) NSString *message;
2026-01-23 21:51:37 +08:00
@property(nonatomic, copy, nullable) NSString *aiResponse;
@property(nonatomic, copy, nullable) NSString *audioId;
@property(nonatomic, assign) NSInteger llmDuration;
2026-01-22 22:03:56 +08:00
@end
@interface KBAiMessageResponse : NSObject
@property(nonatomic, assign) NSInteger code;
@property(nonatomic, strong, nullable) KBAiMessageData *data;
@end
typedef void (^AiVMMessageCompletion)(KBAiMessageResponse *_Nullable response,
NSError *_Nullable error);
2026-01-23 21:51:37 +08:00
typedef void (^AiVMAudioURLCompletion)(NSString *_Nullable audioURL,
NSError *_Nullable error);
2026-01-22 22:03:56 +08:00
2026-01-22 13:47:34 +08:00
@interface AiVM : NSObject
2026-01-22 22:03:56 +08:00
- (void)syncChatWithTranscript:(NSString *)transcript
completion:(AiVMSyncCompletion)completion;
- (void)requestChatMessageWithContent:(NSString *)content
completion:(AiVMMessageCompletion)completion;
2026-01-23 21:51:37 +08:00
/// 根据 audioId 获取音频 URL
- (void)requestAudioWithAudioId:(NSString *)audioId
completion:(AiVMAudioURLCompletion)completion;
2026-01-22 22:03:56 +08:00
2026-01-26 16:53:41 +08:00
#pragma mark - 人设相关接口
/// 分页查询人设列表
/// @param pageNum 页码(从 1 开始)
/// @param pageSize 每页大小
/// @param completion 完成回调
- (void)fetchPersonasWithPageNum:(NSInteger)pageNum
pageSize:(NSInteger)pageSize
completion:(void(^)(KBPersonaPageModel * _Nullable pageModel, NSError * _Nullable error))completion;
2026-01-26 18:17:02 +08:00
/// 分页查询聊天记录
/// @param companionId AI 陪聊角色 ID
/// @param pageNum 页码(从 1 开始)
/// @param pageSize 每页大小
/// @param completion 完成回调
- (void)fetchChatHistoryWithCompanionId:(NSInteger)companionId
pageNum:(NSInteger)pageNum
pageSize:(NSInteger)pageSize
completion:(void(^)(KBChatHistoryPageModel * _Nullable pageModel, NSError * _Nullable error))completion;
2026-01-22 13:47:34 +08:00
@end
NS_ASSUME_NONNULL_END