fix: ai chat 列表页点击标题栏的新建对话图标后,在输入框输入问题,按enter键后实际没有发送消息

This commit is contained in:
jingrow 2026-05-26 19:31:19 +08:00
parent 0d2dab5e2e
commit e2bd63b7fa

View File

@ -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()