fix: listByConversation 在 conversation 不存在时返回空列表而非抛异常

This commit is contained in:
2026-06-28 22:40:13 +08:00
parent caaeb94477
commit e3eb1afbb0
3 changed files with 95 additions and 3 deletions
+5 -1
View File
@@ -661,7 +661,11 @@ const continueCurrentVersion = () => {
}
const loadMessages = async () => {
if (!conversationId.value) return
// 短路保护:conversationId 为空时不请求接口,显示友好提示
if (!conversationId.value) {
uni.showToast({ title: '暂无对话记录', icon: 'none' })
return
}
try {
const res = await listMessagesByConversation({ conversationId: conversationId.value, includeVersions: false })
messages.value = res.data || []