【解决todo】AI 删除对话,不默认选中

This commit is contained in:
cherishsince
2024-05-22 17:08:13 +08:00
parent e7403ba2a4
commit 89deddb9e0
2 changed files with 25 additions and 10 deletions

View File

@@ -174,15 +174,15 @@ const getChatConversationList = async () => {
conversationList.value = res
// 3、默认选中
if (!activeId?.value) {
await handleConversationClick(res[0].id)
// await handleConversationClick(res[0].id)
} else {
// tip: 删除的刚好是选中的,那么需要重新挑选一个来进行选中
const filterConversationList = conversationList.value.filter(item => {
return item.id === activeId.value
})
if (filterConversationList.length <= 0) {
await handleConversationClick(res[0].id)
}
// const filterConversationList = conversationList.value.filter(item => {
// return item.id === activeId.value
// })
// if (filterConversationList.length <= 0) {
// await handleConversationClick(res[0].id)
// }
}
// 4、没有 任何对话情况
if (conversationList.value.length === 0) {
@@ -367,6 +367,9 @@ watch(activeId, async (newValue, oldValue) => {
activeConversationId.value = newValue as string
})
// 定义 public 方法
defineExpose({createConversation})
onMounted(async () => {
// 默认选中
if (props.activeId != null) {