perf: Assistant new chat

This commit is contained in:
fit2cloud-chenyw
2025-07-26 22:10:12 +08:00
parent 09b54e4119
commit bb448bf259
3 changed files with 7 additions and 35 deletions
+2 -15
View File
@@ -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) {
+3 -13
View File
@@ -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()
+2 -7
View File
@@ -7,13 +7,8 @@
<img :src="LOGO" class="logo" width="30px" height="30px" alt="" />
<span class="tite">{{ $t('embedded.intelligent_customer_service') }}</span>
<el-tooltip
effect="dark"
:content="$t('embedded.new_conversation')"
placement="top"
@click="createChat"
>
<el-icon class="new-chat" size="20">
<el-tooltip effect="dark" :content="$t('embedded.new_conversation')" placement="top">
<el-icon class="new-chat" size="20" @click="createChat">
<icon_new_chat_outlined></icon_new_chat_outlined>
</el-icon>
</el-tooltip>