| | |
| | | import { nextTick, onMounted, reactive, ref } from 'vue'; |
| | | import type { ChatRoomItem } from './types'; |
| | | import router from '/@/router'; |
| | | import { CreateHistoryGroup, GetHistoryGroups } from '/@/api/ai/chat'; |
| | | import { CreateHistoryGroup, DeleteHistoryGroups, GetHistoryGroups } from '/@/api/ai/chat'; |
| | | import { chatRoomList, activeRoomId } from '/@/stores/chatRoom'; |
| | | let state = reactive({ |
| | | searchInput: '', |
| | |
| | | }, |
| | | }); |
| | | } |
| | | setTimeout(() => { |
| | | activeRoomId.value = room.id; |
| | | |
| | | }, 0); |
| | | |
| | | |
| | | |
| | | }; |
| | | |
| | | const newChatRoomClick = async () => { |
| | |
| | | } else { |
| | | chatRoomList.value.unshift(newRoom); |
| | | } |
| | | activeRoomId.value = newRoom.id; |
| | | nextTick(() => { |
| | | gotoAnswerPage(newRoom); |
| | | }); |
| | | gotoAnswerPage(newRoom); |
| | | }; |
| | | |
| | | const roomClick = (room: ChatRoomItem) => { |
| | | activeRoomId.value = room.id; |
| | | gotoAnswerPage(room); |
| | | }; |
| | | |
| | | const confirmDeleteChatRoom = (room: ChatRoomItem) => { |
| | | const confirmDeleteChatRoom =async (room: ChatRoomItem) => { |
| | | |
| | | |
| | | const res = await DeleteHistoryGroups({ |
| | | history_group_id:room.id |
| | | }); |
| | | |
| | | const foundIndex = chatRoomList.value.findIndex((item) => item === room); |
| | | chatRoomList.value.splice(foundIndex, 1); |
| | | if (chatRoomList.value.length === 0) { |