1
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#import "KBChatTableView.h"
|
||||
#import "KBAiRecordButton.h"
|
||||
#import "KBHUD.h"
|
||||
#import "KBChatLimitPopView.h"
|
||||
#import "KBVipPay.h"
|
||||
#import "LSTPopView.h"
|
||||
#import "VoiceChatStreamingManager.h"
|
||||
#import "KBUserSessionManager.h"
|
||||
@@ -22,8 +24,10 @@
|
||||
@interface KBAiMainVC () <KBAiRecordButtonDelegate,
|
||||
VoiceChatStreamingManagerDelegate,
|
||||
DeepgramStreamingManagerDelegate,
|
||||
AVAudioPlayerDelegate>
|
||||
AVAudioPlayerDelegate,
|
||||
KBChatLimitPopViewDelegate>
|
||||
@property(nonatomic, weak) LSTPopView *popView;
|
||||
@property(nonatomic, weak) LSTPopView *limitPopView;
|
||||
|
||||
// UI
|
||||
@property(nonatomic, strong) KBChatTableView *chatView;
|
||||
@@ -419,6 +423,48 @@
|
||||
self.commentView = customView;
|
||||
}
|
||||
|
||||
#pragma mark - 次数用尽弹窗
|
||||
|
||||
- (void)showChatLimitPopWithMessage:(NSString *)message {
|
||||
if (self.limitPopView) {
|
||||
[self.limitPopView dismiss];
|
||||
}
|
||||
|
||||
CGFloat width = KB_SCREEN_WIDTH - 60;
|
||||
KBChatLimitPopView *content =
|
||||
[[KBChatLimitPopView alloc] initWithFrame:CGRectMake(0, 0, width, 180)];
|
||||
content.message = message;
|
||||
content.delegate = self;
|
||||
|
||||
LSTPopView *popView =
|
||||
[LSTPopView initWithCustomView:content
|
||||
parentView:nil
|
||||
popStyle:LSTPopStyleFade
|
||||
dismissStyle:LSTDismissStyleFade];
|
||||
popView.bgColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
|
||||
popView.hemStyle = LSTHemStyleCenter;
|
||||
popView.isClickBgDismiss = YES;
|
||||
popView.isAvoidKeyboard = NO;
|
||||
self.limitPopView = popView;
|
||||
[popView pop];
|
||||
}
|
||||
|
||||
#pragma mark - KBChatLimitPopViewDelegate
|
||||
|
||||
- (void)chatLimitPopViewDidTapCancel:(KBChatLimitPopView *)view {
|
||||
[self.limitPopView dismiss];
|
||||
}
|
||||
|
||||
- (void)chatLimitPopViewDidTapRecharge:(KBChatLimitPopView *)view {
|
||||
[self.limitPopView dismiss];
|
||||
if (![KBUserSessionManager shared].isLoggedIn) {
|
||||
[[KBUserSessionManager shared] goLoginVC];
|
||||
return;
|
||||
}
|
||||
KBVipPay *vc = [[KBVipPay alloc] init];
|
||||
[KB_CURRENT_NAV pushViewController:vc animated:true];
|
||||
}
|
||||
|
||||
#pragma mark - UI Updates
|
||||
|
||||
- (void)updateStatusForState:(ConversationState)state {
|
||||
@@ -685,6 +731,18 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.code == 50030) {
|
||||
NSString *message = response.message ?: @"";
|
||||
[strongSelf showChatLimitPopWithMessage:message];
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response || !response.data) {
|
||||
NSString *message = response.message ?: @"AI 回复为空";
|
||||
[KBHUD showError:message];
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取 AI 回复文本
|
||||
NSString *aiResponse = response.data.aiResponse ?: response.data.content ?: response.data.text ?: response.data.message ?: @"";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user