mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: Assistant new chat
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user