Skip to content

Commit bb448bf

Browse files
perf: Assistant new chat
1 parent 09b54e4 commit bb448bf

File tree

3 files changed

+7
-35
lines changed

3 files changed

+7
-35
lines changed

frontend/src/views/chat/ChatListContainer.vue

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,25 +114,12 @@ function goEmpty(func?: (...p: any[]) => void, ...params: any[]) {
114114
const createNewChat = async () => {
115115
goEmpty(doCreateNewChat)
116116
}
117-
const isAssistantRepeatEmpty = () => {
118-
return (
119-
isAssistant.value &&
120-
(_currentChatId.value === null || typeof _currentChatId.value === 'undefined')
121-
)
122-
}
117+
123118
async function doCreateNewChat() {
124119
if (isAssistant.value) {
125-
if (isAssistantRepeatEmpty()) {
126-
return
127-
}
128-
const assistantChat = await assistantStore.setChat()
129-
if (assistantChat) {
130-
onChatCreated(assistantChat)
131-
}
132120
return
133-
} else {
134-
chatCreatorRef.value?.showDs()
135121
}
122+
chatCreatorRef.value?.showDs()
136123
}
137124
138125
function onClickHistory(chat: Chat) {

frontend/src/views/chat/index.vue

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -419,22 +419,12 @@ const createNewChatSimple = async () => {
419419
currentChatId.value = undefined
420420
await createNewChat()
421421
}
422-
const isAssistantRepeatEmpty = () => {
423-
return (
424-
isAssistant.value &&
425-
(currentChatId.value === null || typeof currentChatId.value === 'undefined')
426-
)
427-
}
422+
428423
const createNewChat = async () => {
429424
goEmpty()
430-
if (isAssistantRepeatEmpty()) {
431-
return
432-
}
433425
if (isAssistant.value) {
434-
const assistantChat = await assistantStore.setChat()
435-
if (assistantChat) {
436-
onChatCreatedQuick(assistantChat as any)
437-
}
426+
currentChat.value = new ChatInfo()
427+
currentChatId.value = undefined
438428
return
439429
}
440430
chatCreatorRef.value?.showDs()

frontend/src/views/embedded/index.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@
77
<img :src="LOGO" class="logo" width="30px" height="30px" alt="" />
88
<span class="tite">{{ $t('embedded.intelligent_customer_service') }}</span>
99

10-
<el-tooltip
11-
effect="dark"
12-
:content="$t('embedded.new_conversation')"
13-
placement="top"
14-
@click="createChat"
15-
>
16-
<el-icon class="new-chat" size="20">
10+
<el-tooltip effect="dark" :content="$t('embedded.new_conversation')" placement="top">
11+
<el-icon class="new-chat" size="20" @click="createChat">
1712
<icon_new_chat_outlined></icon_new_chat_outlined>
1813
</el-icon>
1914
</el-tooltip>

0 commit comments

Comments
 (0)