diff --git a/keyBoard.xcodeproj/project.pbxproj b/keyBoard.xcodeproj/project.pbxproj index 0a51866..fe96fc6 100644 --- a/keyBoard.xcodeproj/project.pbxproj +++ b/keyBoard.xcodeproj/project.pbxproj @@ -56,7 +56,6 @@ 046086732F191B6900757C95 /* KBAiMainVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 046086722F191B6900757C95 /* KBAiMainVC.m */; }; 046086752F191CC700757C95 /* AI技术分析.txt in Resources */ = {isa = PBXBuildFile; fileRef = 046086742F191CC700757C95 /* AI技术分析.txt */; }; 0460869A2F19238500757C95 /* KBAiWaveformView.m in Sources */ = {isa = PBXBuildFile; fileRef = 046086992F19238500757C95 /* KBAiWaveformView.m */; }; - 0460869B2F19238500757C95 /* KBAiChatView.m in Sources */ = {isa = PBXBuildFile; fileRef = 046086952F19238500757C95 /* KBAiChatView.m */; }; 0460869C2F19238500757C95 /* KBAiRecordButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 046086972F19238500757C95 /* KBAiRecordButton.m */; }; 046086B12F19239B00757C95 /* SubtitleSync.m in Sources */ = {isa = PBXBuildFile; fileRef = 046086AC2F19239B00757C95 /* SubtitleSync.m */; }; 046086B22F19239B00757C95 /* TTSServiceClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 046086B02F19239B00757C95 /* TTSServiceClient.m */; }; @@ -389,8 +388,6 @@ 046086712F191B6900757C95 /* KBAiMainVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBAiMainVC.h; sourceTree = ""; }; 046086722F191B6900757C95 /* KBAiMainVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBAiMainVC.m; sourceTree = ""; }; 046086742F191CC700757C95 /* AI技术分析.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = "AI技术分析.txt"; sourceTree = ""; }; - 046086942F19238500757C95 /* KBAiChatView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBAiChatView.h; sourceTree = ""; }; - 046086952F19238500757C95 /* KBAiChatView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBAiChatView.m; sourceTree = ""; }; 046086962F19238500757C95 /* KBAiRecordButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBAiRecordButton.h; sourceTree = ""; }; 046086972F19238500757C95 /* KBAiRecordButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBAiRecordButton.m; sourceTree = ""; }; 046086982F19238500757C95 /* KBAiWaveformView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBAiWaveformView.h; sourceTree = ""; }; @@ -1056,39 +1053,17 @@ 0460866D2F191A5100757C95 /* V */ = { isa = PBXGroup; children = ( - 046086942F19238500757C95 /* KBAiChatView.h */, - 046086952F19238500757C95 /* KBAiChatView.m */, + 048FFD3D2F2B2A14005D62AE /* PopView */, + 048FFD3C2F2B2905005D62AE /* Chat */, + 048FFD3B2F2B289C005D62AE /* Comment */, + 048FFD3A2F2B2869005D62AE /* Message */, 046086962F19238500757C95 /* KBAiRecordButton.h */, 046086972F19238500757C95 /* KBAiRecordButton.m */, 046086982F19238500757C95 /* KBAiWaveformView.h */, 046086992F19238500757C95 /* KBAiWaveformView.m */, - 046086BB2F1A039F00757C95 /* KBAICommentView.h */, - 046086BC2F1A039F00757C95 /* KBAICommentView.m */, - 046086CE2F1A093400757C95 /* KBAICommentFooterView.h */, - 046086CF2F1A093400757C95 /* KBAICommentFooterView.m */, - 046086D02F1A093400757C95 /* KBAICommentHeaderView.h */, - 046086D12F1A093400757C95 /* KBAICommentHeaderView.m */, - 046086D22F1A093400757C95 /* KBAICommentInputView.h */, - 046086D32F1A093400757C95 /* KBAICommentInputView.m */, - 046086D42F1A093400757C95 /* KBAIReplyCell.h */, - 046086D52F1A093400757C95 /* KBAIReplyCell.m */, - 04E039422F236E75002CA5A0 /* KBChatAssistantMessageCell.h */, - 04E039432F236E75002CA5A0 /* KBChatAssistantMessageCell.m */, - 04E039442F236E75002CA5A0 /* KBChatTableView.h */, - 04E039452F236E75002CA5A0 /* KBChatTableView.m */, 04E039462F236E75002CA5A0 /* KBChatTableView_Usage.md */, - 04E039472F236E75002CA5A0 /* KBChatTimeCell.h */, - 04E039482F236E75002CA5A0 /* KBChatTimeCell.m */, - 04E039492F236E75002CA5A0 /* KBChatUserMessageCell.h */, - 04E0394A2F236E75002CA5A0 /* KBChatUserMessageCell.m */, - 048FFD122F274342005D62AE /* KBPersonaChatCell.h */, - 048FFD132F274342005D62AE /* KBPersonaChatCell.m */, 048FFD162F2763A5005D62AE /* KBVoiceInputBar.h */, 048FFD172F2763A5005D62AE /* KBVoiceInputBar.m */, - 048FFD222F28A836005D62AE /* KBChatLimitPopView.h */, - 048FFD232F28A836005D62AE /* KBChatLimitPopView.m */, - 048FFD382F29F410005D62AE /* KBAIMessageCell.h */, - 048FFD392F29F410005D62AE /* KBAIMessageCell.m */, ); path = V; sourceTree = ""; @@ -1374,6 +1349,58 @@ path = UICollectionViewLeftAlignedLayout; sourceTree = ""; }; + 048FFD3A2F2B2869005D62AE /* Message */ = { + isa = PBXGroup; + children = ( + 048FFD382F29F410005D62AE /* KBAIMessageCell.h */, + 048FFD392F29F410005D62AE /* KBAIMessageCell.m */, + ); + path = Message; + sourceTree = ""; + }; + 048FFD3B2F2B289C005D62AE /* Comment */ = { + isa = PBXGroup; + children = ( + 046086BB2F1A039F00757C95 /* KBAICommentView.h */, + 046086BC2F1A039F00757C95 /* KBAICommentView.m */, + 046086CE2F1A093400757C95 /* KBAICommentFooterView.h */, + 046086CF2F1A093400757C95 /* KBAICommentFooterView.m */, + 046086D02F1A093400757C95 /* KBAICommentHeaderView.h */, + 046086D12F1A093400757C95 /* KBAICommentHeaderView.m */, + 046086D22F1A093400757C95 /* KBAICommentInputView.h */, + 046086D32F1A093400757C95 /* KBAICommentInputView.m */, + 046086D42F1A093400757C95 /* KBAIReplyCell.h */, + 046086D52F1A093400757C95 /* KBAIReplyCell.m */, + ); + path = Comment; + sourceTree = ""; + }; + 048FFD3C2F2B2905005D62AE /* Chat */ = { + isa = PBXGroup; + children = ( + 048FFD122F274342005D62AE /* KBPersonaChatCell.h */, + 048FFD132F274342005D62AE /* KBPersonaChatCell.m */, + 04E039442F236E75002CA5A0 /* KBChatTableView.h */, + 04E039452F236E75002CA5A0 /* KBChatTableView.m */, + 04E039492F236E75002CA5A0 /* KBChatUserMessageCell.h */, + 04E0394A2F236E75002CA5A0 /* KBChatUserMessageCell.m */, + 04E039422F236E75002CA5A0 /* KBChatAssistantMessageCell.h */, + 04E039432F236E75002CA5A0 /* KBChatAssistantMessageCell.m */, + 04E039472F236E75002CA5A0 /* KBChatTimeCell.h */, + 04E039482F236E75002CA5A0 /* KBChatTimeCell.m */, + ); + path = Chat; + sourceTree = ""; + }; + 048FFD3D2F2B2A14005D62AE /* PopView */ = { + isa = PBXGroup; + children = ( + 048FFD222F28A836005D62AE /* KBChatLimitPopView.h */, + 048FFD232F28A836005D62AE /* KBChatLimitPopView.m */, + ); + path = PopView; + sourceTree = ""; + }; 0498BD5F2EDFFBFC006CC1D5 /* VM */ = { isa = PBXGroup; children = ( @@ -2500,7 +2527,6 @@ 0477BDFD2EBC6A170055D639 /* HomeHotVC.m in Sources */, 04E039522F2387D2002CA5A0 /* KBAiChatMessage.m in Sources */, 0460869A2F19238500757C95 /* KBAiWaveformView.m in Sources */, - 0460869B2F19238500757C95 /* KBAiChatView.m in Sources */, 0460869C2F19238500757C95 /* KBAiRecordButton.m in Sources */, 04122FAA2EC73C0100EF7AB3 /* KBVipPayHeaderView.m in Sources */, 0498BD622EDFFC12006CC1D5 /* KBMyVM.m in Sources */, diff --git a/keyBoard/Class/AiTalk/V/KBChatAssistantMessageCell.h b/keyBoard/Class/AiTalk/V/Chat/KBChatAssistantMessageCell.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBChatAssistantMessageCell.h rename to keyBoard/Class/AiTalk/V/Chat/KBChatAssistantMessageCell.h diff --git a/keyBoard/Class/AiTalk/V/KBChatAssistantMessageCell.m b/keyBoard/Class/AiTalk/V/Chat/KBChatAssistantMessageCell.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBChatAssistantMessageCell.m rename to keyBoard/Class/AiTalk/V/Chat/KBChatAssistantMessageCell.m diff --git a/keyBoard/Class/AiTalk/V/KBChatTableView.h b/keyBoard/Class/AiTalk/V/Chat/KBChatTableView.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBChatTableView.h rename to keyBoard/Class/AiTalk/V/Chat/KBChatTableView.h diff --git a/keyBoard/Class/AiTalk/V/KBChatTableView.m b/keyBoard/Class/AiTalk/V/Chat/KBChatTableView.m similarity index 98% rename from keyBoard/Class/AiTalk/V/KBChatTableView.m rename to keyBoard/Class/AiTalk/V/Chat/KBChatTableView.m index cd5f33d..6a3a0e4 100644 --- a/keyBoard/Class/AiTalk/V/KBChatTableView.m +++ b/keyBoard/Class/AiTalk/V/Chat/KBChatTableView.m @@ -194,6 +194,18 @@ static const NSTimeInterval kTimestampInterval = 5 * 60; // 5 分钟 } } +- (void)markLastUserMessageLoadingComplete { + for (NSInteger i = self.messages.count - 1; i >= 0; i--) { + KBAiChatMessage *message = self.messages[i]; + if (message.type == KBAiChatMessageTypeUser) { + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:0]; + [self.tableView reloadRowsAtIndexPaths:@[indexPath] + withRowAnimation:UITableViewRowAnimationNone]; + return; + } + } +} + - (void)clearMessages { [self.messages removeAllObjects]; [self.tableView reloadData]; diff --git a/keyBoard/Class/AiTalk/V/KBChatTimeCell.h b/keyBoard/Class/AiTalk/V/Chat/KBChatTimeCell.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBChatTimeCell.h rename to keyBoard/Class/AiTalk/V/Chat/KBChatTimeCell.h diff --git a/keyBoard/Class/AiTalk/V/KBChatTimeCell.m b/keyBoard/Class/AiTalk/V/Chat/KBChatTimeCell.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBChatTimeCell.m rename to keyBoard/Class/AiTalk/V/Chat/KBChatTimeCell.m diff --git a/keyBoard/Class/AiTalk/V/KBChatUserMessageCell.h b/keyBoard/Class/AiTalk/V/Chat/KBChatUserMessageCell.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBChatUserMessageCell.h rename to keyBoard/Class/AiTalk/V/Chat/KBChatUserMessageCell.h diff --git a/keyBoard/Class/AiTalk/V/KBChatUserMessageCell.m b/keyBoard/Class/AiTalk/V/Chat/KBChatUserMessageCell.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBChatUserMessageCell.m rename to keyBoard/Class/AiTalk/V/Chat/KBChatUserMessageCell.m diff --git a/keyBoard/Class/AiTalk/V/KBPersonaChatCell.h b/keyBoard/Class/AiTalk/V/Chat/KBPersonaChatCell.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBPersonaChatCell.h rename to keyBoard/Class/AiTalk/V/Chat/KBPersonaChatCell.h diff --git a/keyBoard/Class/AiTalk/V/KBPersonaChatCell.m b/keyBoard/Class/AiTalk/V/Chat/KBPersonaChatCell.m similarity index 99% rename from keyBoard/Class/AiTalk/V/KBPersonaChatCell.m rename to keyBoard/Class/AiTalk/V/Chat/KBPersonaChatCell.m index c059e75..3decfa7 100644 --- a/keyBoard/Class/AiTalk/V/KBPersonaChatCell.m +++ b/keyBoard/Class/AiTalk/V/Chat/KBPersonaChatCell.m @@ -453,6 +453,10 @@ static NSString * const KBChatSessionDidResetNotification = @"KBChatSessionDidRe [self.chatView addMessage:message autoScroll:YES]; } +- (void)markLastUserMessageLoadingComplete { +// [self.chatView markLastUserMessageLoadingComplete]; +} + - (void)appendAssistantMessage:(NSString *)text audioId:(NSString *)audioId { if (text.length == 0) { diff --git a/keyBoard/Class/AiTalk/V/KBAICommentFooterView.h b/keyBoard/Class/AiTalk/V/Comment/KBAICommentFooterView.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAICommentFooterView.h rename to keyBoard/Class/AiTalk/V/Comment/KBAICommentFooterView.h diff --git a/keyBoard/Class/AiTalk/V/KBAICommentFooterView.m b/keyBoard/Class/AiTalk/V/Comment/KBAICommentFooterView.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAICommentFooterView.m rename to keyBoard/Class/AiTalk/V/Comment/KBAICommentFooterView.m diff --git a/keyBoard/Class/AiTalk/V/KBAICommentHeaderView.h b/keyBoard/Class/AiTalk/V/Comment/KBAICommentHeaderView.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAICommentHeaderView.h rename to keyBoard/Class/AiTalk/V/Comment/KBAICommentHeaderView.h diff --git a/keyBoard/Class/AiTalk/V/KBAICommentHeaderView.m b/keyBoard/Class/AiTalk/V/Comment/KBAICommentHeaderView.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAICommentHeaderView.m rename to keyBoard/Class/AiTalk/V/Comment/KBAICommentHeaderView.m diff --git a/keyBoard/Class/AiTalk/V/KBAICommentInputView.h b/keyBoard/Class/AiTalk/V/Comment/KBAICommentInputView.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAICommentInputView.h rename to keyBoard/Class/AiTalk/V/Comment/KBAICommentInputView.h diff --git a/keyBoard/Class/AiTalk/V/KBAICommentInputView.m b/keyBoard/Class/AiTalk/V/Comment/KBAICommentInputView.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAICommentInputView.m rename to keyBoard/Class/AiTalk/V/Comment/KBAICommentInputView.m diff --git a/keyBoard/Class/AiTalk/V/KBAICommentView.h b/keyBoard/Class/AiTalk/V/Comment/KBAICommentView.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAICommentView.h rename to keyBoard/Class/AiTalk/V/Comment/KBAICommentView.h diff --git a/keyBoard/Class/AiTalk/V/KBAICommentView.m b/keyBoard/Class/AiTalk/V/Comment/KBAICommentView.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAICommentView.m rename to keyBoard/Class/AiTalk/V/Comment/KBAICommentView.m diff --git a/keyBoard/Class/AiTalk/V/KBAIReplyCell.h b/keyBoard/Class/AiTalk/V/Comment/KBAIReplyCell.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAIReplyCell.h rename to keyBoard/Class/AiTalk/V/Comment/KBAIReplyCell.h diff --git a/keyBoard/Class/AiTalk/V/KBAIReplyCell.m b/keyBoard/Class/AiTalk/V/Comment/KBAIReplyCell.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAIReplyCell.m rename to keyBoard/Class/AiTalk/V/Comment/KBAIReplyCell.m diff --git a/keyBoard/Class/AiTalk/V/KBAIMessageCell.h b/keyBoard/Class/AiTalk/V/Message/KBAIMessageCell.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAIMessageCell.h rename to keyBoard/Class/AiTalk/V/Message/KBAIMessageCell.h diff --git a/keyBoard/Class/AiTalk/V/KBAIMessageCell.m b/keyBoard/Class/AiTalk/V/Message/KBAIMessageCell.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBAIMessageCell.m rename to keyBoard/Class/AiTalk/V/Message/KBAIMessageCell.m diff --git a/keyBoard/Class/AiTalk/V/KBChatLimitPopView.h b/keyBoard/Class/AiTalk/V/PopView/KBChatLimitPopView.h similarity index 100% rename from keyBoard/Class/AiTalk/V/KBChatLimitPopView.h rename to keyBoard/Class/AiTalk/V/PopView/KBChatLimitPopView.h diff --git a/keyBoard/Class/AiTalk/V/KBChatLimitPopView.m b/keyBoard/Class/AiTalk/V/PopView/KBChatLimitPopView.m similarity index 100% rename from keyBoard/Class/AiTalk/V/KBChatLimitPopView.m rename to keyBoard/Class/AiTalk/V/PopView/KBChatLimitPopView.m