处理键盘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

@@ -1073,7 +1073,7 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
__strong typeof(weakSelf) self = weakSelf;
if (!self) return;
if (!response.success) {
if (response.code != 0) {
if (response.code == 50030) {
NSLog(@"[KB] ⚠️ 次数用尽: %@", response.message);
[self.chatPanelView kb_removeLoadingAssistantMessage];
@@ -1086,9 +1086,9 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
return;
}
NSLog(@"[KB] ✅ 收到回复: %@", response.text);
NSLog(@"[KB] ✅ 收到回复: %@", response.data.aiResponse);
if (response.text.length == 0) {
if (response.data.aiResponse.length == 0) {
[self.chatPanelView kb_removeLoadingAssistantMessage];
[KBHUD showInfo:KBLocalized(@"未获取到回复内容")];
return;
@@ -1096,12 +1096,12 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
// AI
NSLog(@"[KB] 准备添加 AI 消息");
[self.chatPanelView kb_addAssistantMessage:response.text audioId:response.audioId];
[self.chatPanelView kb_addAssistantMessage:response.data.aiResponse audioId:response.data.audioId];
NSLog(@"[KB] AI 消息添加完成");
// audioId
if (response.audioId.length > 0) {
[self kb_preloadAudioWithAudioId:response.audioId];
if (response.data.audioId.length > 0) {
[self kb_preloadAudioWithAudioId:response.data.audioId];
}
}];
}