分类移动文件

This commit is contained in:
2026-01-29 13:44:52 +08:00
parent 4392296616
commit 25fbe9b64e
25 changed files with 72 additions and 30 deletions

View File

@@ -0,0 +1,74 @@
//
// KBChatTableView.h
// keyBoard
//
// Created by Kiro on 2026/1/23.
//
#import <UIKit/UIKit.h>
#import "KBAiChatMessage.h"
NS_ASSUME_NONNULL_BEGIN
@class KBChatTableView;
@protocol KBChatTableViewDelegate <NSObject>
@optional
- (void)chatTableViewDidScroll:(KBChatTableView *)chatView
scrollView:(UIScrollView *)scrollView;
- (void)chatTableViewDidTriggerLoadMore:(KBChatTableView *)chatView;
@end
/// 聊天列表视图支持用户消息、AI 消息、时间戳、语音播放)
@interface KBChatTableView : UIView
@property (nonatomic, weak) id<KBChatTableViewDelegate> delegate;
/// 添加用户消息
- (void)addUserMessage:(NSString *)text;
/// 添加 AI 消息(带语音)
- (void)addAssistantMessage:(NSString *)text
audioDuration:(NSTimeInterval)duration
audioData:(nullable NSData *)audioData;
/// 添加 AI 消息(带 audioId异步加载音频
- (void)addAssistantMessage:(NSString *)text
audioId:(nullable NSString *)audioId;
/// 更新最后一条 AI 消息(用于打字机效果)
- (void)updateLastAssistantMessage:(NSString *)text;
/// 标记最后一条 AI 消息完成
- (void)markLastAssistantMessageComplete;
/// 清空所有消息
- (void)clearMessages;
/// 滚动到底部
- (void)scrollToBottom;
/// 停止正在播放的音频
- (void)stopPlayingAudio;
/// 结束加载更多
- (void)endLoadMoreWithHasMoreData:(BOOL)hasMoreData;
/// 重置无更多数据状态
- (void)resetNoMoreData;
/// 更新底部内容 inset用于避开输入栏/键盘)
- (void)updateContentBottomInset:(CGFloat)bottomInset;
/// 添加自定义消息(可用于历史消息或打字机)
- (void)addMessage:(KBAiChatMessage *)message
autoScroll:(BOOL)autoScroll;
/// 用指定消息重载(用于历史消息分页)
- (void)reloadWithMessages:(NSArray<KBAiChatMessage *> *)messages
keepOffset:(BOOL)keepOffset
scrollToBottom:(BOOL)scrollToBottom;
@end
NS_ASSUME_NONNULL_END