// // KBChatPanelView.h // CustomKeyboard // #import @class KBChatPanelView, KBChatMessage; NS_ASSUME_NONNULL_BEGIN @protocol KBChatPanelViewDelegate @optional - (void)chatPanelView:(KBChatPanelView *)view didSendText:(NSString *)text; - (void)chatPanelView:(KBChatPanelView *)view didTapMessage:(KBChatMessage *)message; - (void)chatPanelViewDidTapClose:(KBChatPanelView *)view; /// 点击语音播放按钮 - (void)chatPanelView:(KBChatPanelView *)view didTapVoiceButtonForMessage:(KBChatMessage *)message; @end @interface KBChatPanelView : UIView @property (nonatomic, weak) id delegate; @property (nonatomic, strong, readonly) UITableView *tableView; //- (void)kb_setBackgroundImage:(nullable UIImage *)image; - (void)kb_reloadWithMessages:(NSArray *)messages; /// 添加用户消息 - (void)kb_addUserMessage:(NSString *)text; /// 添加 loading 状态的 AI 消息 - (void)kb_addLoadingAssistantMessage; /// 移除 loading 状态的 AI 消息 - (void)kb_removeLoadingAssistantMessage; /// 添加 AI 消息(带打字机效果) - (void)kb_addAssistantMessage:(NSString *)text audioId:(nullable NSString *)audioId; /// 更新最后一条 AI 消息的音频数据 - (void)kb_updateLastAssistantMessageWithAudioData:(NSData *)audioData duration:(NSTimeInterval)duration; /// 滚动到底部 - (void)kb_scrollToBottom; @end NS_ASSUME_NONNULL_END