fix: ai chat 列表页点击标题栏的新建对话图标后,在输入框输入问题,按enter键后实际没有发送消息
This commit is contained in:
parent
0d2dab5e2e
commit
e2bd63b7fa
@ -2,7 +2,7 @@
|
||||
import { ref, onMounted, computed, watch, nextTick } from 'vue'
|
||||
import { NButton, NSpin, NPagination, NDropdown } from 'naive-ui'
|
||||
import { Icon } from '@iconify/vue'
|
||||
import { getChatList, createChat, type AiChat } from '@/shared/api/chat'
|
||||
import { getChatList, createChat, sendMessage, type AiChat } from '@/shared/api/chat'
|
||||
import { updateRecord, deleteRecord } from '@/shared/api/common'
|
||||
import { useAuthStore } from '@/shared/stores/auth'
|
||||
import { t } from '@/shared/i18n'
|
||||
@ -195,12 +195,13 @@ const sending = ref(false)
|
||||
|
||||
async function onWelcomeSend(content: string) {
|
||||
if (sending.value) return
|
||||
// 无活跃对话时,自动创建新对话
|
||||
// 无活跃对话时,自动创建新对话并发送消息
|
||||
if (!activeChatName.value) {
|
||||
try {
|
||||
sending.value = true
|
||||
const createResult = await createChat()
|
||||
if (createResult.success && createResult.name) {
|
||||
await sendMessage(createResult.name, content)
|
||||
activeChatName.value = createResult.name
|
||||
activeChatTitle.value = createResult.title || ''
|
||||
await loadChats()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user