mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
feat(core): remount ai-chat-content when session changed (#13200)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Updated chat session management to fully remove and reset chat content instead of updating and reloading it in place. This change may improve stability and clarity when starting new chat sessions or switching between them. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -156,8 +156,8 @@ export const Component = () => {
|
||||
.then(session => {
|
||||
setCurrentSession(session);
|
||||
if (chatContent) {
|
||||
chatContent.session = session;
|
||||
chatContent.reloadSession();
|
||||
chatContent.remove();
|
||||
setChatContent(null);
|
||||
}
|
||||
chatTool?.closeHistoryMenu();
|
||||
})
|
||||
@@ -258,7 +258,8 @@ export const Component = () => {
|
||||
tool.onNewSession = () => {
|
||||
if (!currentSession) return;
|
||||
setCurrentSession(null);
|
||||
chatContent?.reset();
|
||||
chatContent?.remove();
|
||||
setChatContent(null);
|
||||
};
|
||||
|
||||
tool.onTogglePin = async () => {
|
||||
@@ -329,8 +330,8 @@ export const Component = () => {
|
||||
if (!session) return;
|
||||
setCurrentSession(session);
|
||||
if (chatContent) {
|
||||
chatContent.session = session;
|
||||
chatContent.reloadSession();
|
||||
chatContent.remove();
|
||||
setChatContent(null);
|
||||
}
|
||||
})
|
||||
.catch(console.error);
|
||||
|
||||
Reference in New Issue
Block a user