Files
keyboard/CustomKeyboard/View/Chat/KBChatPanelView.h

50 lines
1.4 KiB
C
Raw Normal View History

2026-01-15 18:16:56 +08:00
//
// 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;
2026-01-15 18:49:31 +08:00
- (void)chatPanelViewDidTapClose:(KBChatPanelView *)view;
2026-01-30 13:17:11 +08:00
/// 点击语音播放按钮
- (void)chatPanelView:(KBChatPanelView *)view didTapVoiceButtonForMessage:(KBChatMessage *)message;
2026-01-15 18:16:56 +08:00
@end
@interface KBChatPanelView : UIView
@property (nonatomic, weak) id<KBChatPanelViewDelegate> delegate;
@property (nonatomic, strong, readonly) UITableView *tableView;
2026-01-15 18:49:31 +08:00
//- (void)kb_setBackgroundImage:(nullable UIImage *)image;
2026-01-15 18:16:56 +08:00
- (void)kb_reloadWithMessages:(NSArray<KBChatMessage *> *)messages;
2026-01-30 13:17:11 +08:00
/// 添加用户消息
- (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;
2026-01-15 18:16:56 +08:00
@end
NS_ASSUME_NONNULL_END