聊天记录展示

This commit is contained in:
2025-10-15 18:55:01 +08:00
parent d984cb1457
commit 5714ae08bb
8 changed files with 285 additions and 137 deletions
@@ -129,6 +129,12 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this,
this.onChatCountChange
);
Utils.addInnerEL(
InnerMsgCode.Chat_DialogRefresh,
this,
this.onDialogRefresh
);
}
onDestroy(): void {
@@ -147,6 +153,11 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this,
this.onEmotionInitialized
);
Utils.removeInnerEL(
InnerMsgCode.Chat_DialogRefresh,
this,
this.onDialogRefresh
);
// 停止视频播放,释放资源
if (this.videoLayer) {
@@ -402,6 +413,22 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
}
}
/**
* 对话刷新事件处理(用于加载历史记录)
*/
private onDialogRefresh = (): void => {
if (!this.layout) return;
// 获取所有对话记录
const dialogManager = DialogManager.getInstance();
const allDialogs = dialogManager["dialogData"].getAllDialogs();
logger.log(`ChatPanel: Loading ${allDialogs.length} history dialogs to UI`);
// 加载所有对话到UI
this.layout.loadAllDialogs(allDialogs);
};
protected onEnable(): void {
if (!this.manager) this.manager = DialogManager.getInstance();