setCurrentChatSession method
Implementation
void setCurrentChatSession(ChatSession chatSession) {
if (_currentChatSession?.conversationId == chatSession.conversationId &&
_currentChatSession?.conversationType == chatSession.conversationType) {
Alog.d(
tag: logTag,
content:
'setCurrentChatSession repeat ${chatSession.conversationId} conversationType = ${chatSession.conversationType}');
wight++;
return;
}
// 切换到新会话时,立即同步清空旧缓存,确保后续读取不会拿到旧数据
// (尤其是桌面端/Web端快速切换会话场景)
_clearCacheSync();
_isLoading = false;
_currentChatSession = chatSession;
_currentChatIdNotifier.add(chatSession);
Alog.d(
tag: logTag,
content:
'setCurrentChatSession success ${chatSession.conversationId} conversationType = ${chatSession.conversationType}');
_setCurrentChatCache();
}