处理键盘ai功能

This commit is contained in:
2026-02-05 16:01:21 +08:00
parent 750b391100
commit 3cb02d5b76
5 changed files with 116 additions and 42 deletions

View File

@@ -7,17 +7,25 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class KBChatDataModel;
NS_ASSUME_NONNULL_BEGIN
/// 聊天响应模型
@interface KBChatResponse : NSObject
@property (nonatomic, copy, nullable) NSString *text;
@property (nonatomic, copy, nullable) NSString *audioId;
@property (nonatomic, strong, nullable) KBChatDataModel *data;
//@property (nonatomic, copy, nullable) NSString *audioId;
@property (nonatomic, copy, nullable) NSString *message;
@property (nonatomic, assign) BOOL success;
@property (nonatomic, assign) NSInteger code;
@end
@interface KBChatDataModel : NSObject
@property (nonatomic, copy, nullable) NSString *aiResponse;
@property (nonatomic, copy, nullable) NSString *audioId;
@property (nonatomic, copy, nullable) NSString *llmDuration;
@end
/// 音频响应模型

View File

@@ -12,6 +12,9 @@
@implementation KBChatResponse
@end
@implementation KBChatDataModel
@end
@implementation KBAudioResponse
@end
@@ -68,8 +71,7 @@
completion:^(NSDictionary *json, NSURLResponse *response, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{
KBChatResponse *chatResponse = [KBChatResponse mj_objectWithKeyValues:json];
if (error) {
if (chatResponse.code != 0) {
chatResponse.success = NO;
// chatResponse.errorMessage = error.localizedDescription ?: @"请求失败";
if (completion) completion(chatResponse);