【优化】AI 对话中,不允许切换对话

This commit is contained in:
cherishsince 2024-05-21 22:44:37 +08:00
parent 8f2b81bb79
commit d603f1edd0

View File

@ -150,7 +150,6 @@ const textRoll = async () => {
textSpeed.value = 10
}
console.log(`diff ${diff} 速度 ${textSpeed.value} `)
// console.log('index < fullText.value.length', index < fullText.value.length, conversationInProgress.value)
if (index < fullText.value.length) {
@ -341,12 +340,14 @@ const doSendStream = async (userMessage: ChatMessageVO) => {
await scrollToBottom()
},
(error) => {
console.log('onError')
//
conversationInProgress.value = false
// stream
conversationInAbortController.value.abort()
},
() => {
console.log('onClose')
//
conversationInProgress.value = false
// stream
@ -358,6 +359,7 @@ const doSendStream = async (userMessage: ChatMessageVO) => {
}
const stopStream = async () => {
console.log('stopStream...')
// tip stream message controller
if (conversationInAbortController.value) {
conversationInAbortController.value.abort()
@ -416,13 +418,24 @@ const handlerTitleSuccess = async () => {
* 对话 - 点击
*/
const handleConversationClick = async (conversation: ChatConversationVO) => {
//
if (conversationInProgress.value) {
await message.alert("对话中,不允许切换!")
return false
}
// id
activeConversationId.value = conversation.id
activeConversation.value = conversation
//
if (conversationInProgress.value) {
await stopStream()
}
// message
await getMessageList()
//
scrollToBottom(true)
return true
}
/**