This commit is contained in:
2026-01-30 13:33:23 +08:00
parent 3705db4aab
commit 3c0b7e754c
7 changed files with 15 additions and 7 deletions

View File

@@ -0,0 +1,49 @@
//
// KBChatPanelView.h
// CustomKeyboard
//
#import <UIKit/UIKit.h>
@class KBChatPanelView, KBChatMessage;
NS_ASSUME_NONNULL_BEGIN
@protocol KBChatPanelViewDelegate <NSObject>
@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<KBChatPanelViewDelegate> delegate;
@property (nonatomic, strong, readonly) UITableView *tableView;
//- (void)kb_setBackgroundImage:(nullable UIImage *)image;
- (void)kb_reloadWithMessages:(NSArray<KBChatMessage *> *)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