From bb448bf25992b5f076ca1c1cb43dc7622d9b613e Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Sat, 26 Jul 2025 22:10:12 +0800 Subject: [PATCH] perf: Assistant new chat --- frontend/src/views/chat/ChatListContainer.vue | 17 ++--------------- frontend/src/views/chat/index.vue | 16 +++------------- frontend/src/views/embedded/index.vue | 9 ++------- 3 files changed, 7 insertions(+), 35 deletions(-) diff --git a/frontend/src/views/chat/ChatListContainer.vue b/frontend/src/views/chat/ChatListContainer.vue index f8a54a81..0e2c2104 100644 --- a/frontend/src/views/chat/ChatListContainer.vue +++ b/frontend/src/views/chat/ChatListContainer.vue @@ -114,25 +114,12 @@ function goEmpty(func?: (...p: any[]) => void, ...params: any[]) { const createNewChat = async () => { goEmpty(doCreateNewChat) } -const isAssistantRepeatEmpty = () => { - return ( - isAssistant.value && - (_currentChatId.value === null || typeof _currentChatId.value === 'undefined') - ) -} + async function doCreateNewChat() { if (isAssistant.value) { - if (isAssistantRepeatEmpty()) { - return - } - const assistantChat = await assistantStore.setChat() - if (assistantChat) { - onChatCreated(assistantChat) - } return - } else { - chatCreatorRef.value?.showDs() } + chatCreatorRef.value?.showDs() } function onClickHistory(chat: Chat) { diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index 185aa75b..81dd036a 100644 --- a/frontend/src/views/chat/index.vue +++ b/frontend/src/views/chat/index.vue @@ -419,22 +419,12 @@ const createNewChatSimple = async () => { currentChatId.value = undefined await createNewChat() } -const isAssistantRepeatEmpty = () => { - return ( - isAssistant.value && - (currentChatId.value === null || typeof currentChatId.value === 'undefined') - ) -} + const createNewChat = async () => { goEmpty() - if (isAssistantRepeatEmpty()) { - return - } if (isAssistant.value) { - const assistantChat = await assistantStore.setChat() - if (assistantChat) { - onChatCreatedQuick(assistantChat as any) - } + currentChat.value = new ChatInfo() + currentChatId.value = undefined return } chatCreatorRef.value?.showDs() diff --git a/frontend/src/views/embedded/index.vue b/frontend/src/views/embedded/index.vue index 5bea8c07..4a7b4e97 100644 --- a/frontend/src/views/embedded/index.vue +++ b/frontend/src/views/embedded/index.vue @@ -7,13 +7,8 @@ {{ $t('embedded.intelligent_customer_service') }} - - + +