跨进程 键盘用ai 在主应用里也要显示
This commit is contained in:
@@ -371,6 +371,9 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
audioId:response.data.audioId];
|
||||
NSLog(@"[KB] AI 消息添加完成");
|
||||
|
||||
// 通知主 App 刷新对应 persona 的聊天记录
|
||||
[self kb_notifyMainAppChatUpdatedWithCompanionId:companionId];
|
||||
|
||||
// 如果有 audioId,开始预加载音频
|
||||
if (response.data.audioId.length > 0) {
|
||||
[self kb_preloadAudioWithAudioId:
|
||||
@@ -671,6 +674,22 @@ static const NSUInteger kKBChatMessageLimit = 6;
|
||||
NSLog(@"[Keyboard] 开始播放音频,时长: %.2f秒", player.duration);
|
||||
}
|
||||
|
||||
#pragma mark - Notify Main App
|
||||
|
||||
/// 通知主 App 刷新对应 persona 的聊天记录
|
||||
- (void)kb_notifyMainAppChatUpdatedWithCompanionId:(NSInteger)companionId {
|
||||
NSUserDefaults *ud = [[NSUserDefaults alloc] initWithSuiteName:AppGroup];
|
||||
[ud setInteger:companionId forKey:AppGroup_ChatUpdatedCompanionId];
|
||||
[ud synchronize];
|
||||
|
||||
CFNotificationCenterPostNotification(
|
||||
CFNotificationCenterGetDarwinNotifyCenter(),
|
||||
(__bridge CFStringRef)kKBDarwinChatUpdated,
|
||||
NULL, NULL, true);
|
||||
|
||||
NSLog(@"[KB] 已通知主 App 刷新 companionId=%ld 的聊天记录", (long)companionId);
|
||||
}
|
||||
|
||||
#pragma mark - KBChatLimitPopViewDelegate
|
||||
|
||||
- (void)chatLimitPopViewDidTapCancel:(KBChatLimitPopView *)view {
|
||||
|
||||
Reference in New Issue
Block a user