2026-01-26 16:53:41 +08:00
|
|
|
|
//
|
|
|
|
|
|
// KBPersonaChatCell.h
|
|
|
|
|
|
// keyBoard
|
|
|
|
|
|
//
|
|
|
|
|
|
// Created by Kiro on 2026/1/26.
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
|
#import "KBPersonaModel.h"
|
2026-01-28 17:21:19 +08:00
|
|
|
|
#import "KBChatTableView.h"
|
2026-01-26 16:53:41 +08:00
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
/// 人设聊天 Cell
|
|
|
|
|
|
@interface KBPersonaChatCell : UICollectionViewCell
|
2026-01-28 17:21:19 +08:00
|
|
|
|
/// 聊天列表
|
|
|
|
|
|
@property (nonatomic, strong) KBChatTableView *chatView;
|
2026-01-26 16:53:41 +08:00
|
|
|
|
/// 人设数据
|
|
|
|
|
|
@property (nonatomic, strong) KBPersonaModel *persona;
|
|
|
|
|
|
|
|
|
|
|
|
/// 预加载数据
|
|
|
|
|
|
- (void)preloadDataIfNeeded;
|
|
|
|
|
|
|
2026-01-26 20:36:51 +08:00
|
|
|
|
/// 添加用户消息
|
|
|
|
|
|
- (void)appendUserMessage:(NSString *)text;
|
|
|
|
|
|
|
2026-01-31 23:17:58 +08:00
|
|
|
|
/// 添加用户消息(绑定本次请求 requestId)
|
|
|
|
|
|
- (void)appendUserMessage:(NSString *)text requestId:(NSString *)requestId;
|
|
|
|
|
|
|
2026-01-29 14:42:49 +08:00
|
|
|
|
/// 标记最后一条用户消息结束加载
|
|
|
|
|
|
- (void)markLastUserMessageLoadingComplete;
|
|
|
|
|
|
|
|
|
|
|
|
/// 添加加载中的用户消息
|
|
|
|
|
|
- (void)appendLoadingUserMessage;
|
|
|
|
|
|
|
|
|
|
|
|
/// 更新最后一条用户消息
|
|
|
|
|
|
- (void)updateLastUserMessage:(NSString *)text;
|
|
|
|
|
|
|
2026-02-02 17:41:23 +08:00
|
|
|
|
/// 移除 loading 用户消息
|
|
|
|
|
|
- (void)removeLoadingUserMessage;
|
|
|
|
|
|
|
2026-01-26 20:36:51 +08:00
|
|
|
|
/// 添加 AI 消息(支持打字机效果)
|
|
|
|
|
|
- (void)appendAssistantMessage:(NSString *)text
|
|
|
|
|
|
audioId:(nullable NSString *)audioId;
|
|
|
|
|
|
|
2026-01-29 20:56:24 +08:00
|
|
|
|
/// 添加 loading AI 消息
|
|
|
|
|
|
- (void)appendLoadingAssistantMessage;
|
|
|
|
|
|
|
2026-01-31 23:17:58 +08:00
|
|
|
|
/// 添加 loading AI 消息(绑定本次请求 requestId)
|
|
|
|
|
|
- (void)appendLoadingAssistantMessageWithRequestId:(NSString *)requestId;
|
|
|
|
|
|
|
2026-01-29 20:56:24 +08:00
|
|
|
|
/// 移除 loading AI 消息
|
|
|
|
|
|
- (void)removeLoadingAssistantMessage;
|
|
|
|
|
|
|
2026-01-31 23:17:58 +08:00
|
|
|
|
/// 移除 loading AI 消息(按 requestId 精确移除)
|
|
|
|
|
|
- (void)removeLoadingAssistantMessageWithRequestId:(NSString *)requestId;
|
|
|
|
|
|
|
2026-01-27 16:28:17 +08:00
|
|
|
|
/// 更新聊天列表底部 inset
|
|
|
|
|
|
- (void)updateChatViewBottomInset:(CGFloat)bottomInset;
|
|
|
|
|
|
|
2026-01-31 23:17:58 +08:00
|
|
|
|
/// 更新指定 requestId 对应的 AI 回复(替换 loading 占位消息)
|
|
|
|
|
|
- (void)updateAssistantMessageWithRequestId:(NSString *)requestId
|
|
|
|
|
|
text:(NSString *)text
|
|
|
|
|
|
audioId:(nullable NSString *)audioId;
|
|
|
|
|
|
|
2026-02-02 14:29:42 +08:00
|
|
|
|
/// 当前 Cell 成为屏幕主显示页
|
|
|
|
|
|
- (void)onBecameCurrentPersonaCell;
|
|
|
|
|
|
|
|
|
|
|
|
/// 当前 Cell 不再是屏幕主显示页
|
|
|
|
|
|
- (void)onResignedCurrentPersonaCell;
|
|
|
|
|
|
|
2026-01-26 16:53:41 +08:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|