diff --git a/pages/search/[id].vue b/pages/search/[id].vue index 4e5c1aca9df04bfa3e6d9c4da203d1c374951d03..9f3524cc09c02cb006b8161f1ff4b7e4a78d962a 100644 --- a/pages/search/[id].vue +++ b/pages/search/[id].vue @@ -15,6 +15,7 @@ { generateFetchData(question) } -// todo 唯一key const data = ref([]) const askingData = ref({ question: state.query, desLoading: true }) const recommendQuestions = ref([]) const askingRef = ref(null) +const historyAskRefs = ref([]) // git url const baseGitUrl = computed(() => { const endWidthGit = state.gitPath.endsWith('.git') @@ -119,9 +120,19 @@ let asking = ref(false) // 处理ai generate let aiChatController = null // 用户取消操作方法 const markedEnd = '[DONE]' +const handleCloseHistoryAsk = () => { + historyAskRefs.value.forEach(item => { + if (item && item.handleCollapse) { + item.handleCollapse(false) + } + }) +} const createGenerateInitItem = (question) => { data.value.push(askingData.value) - askingData.value = { question, desLoading: true } + nextTick(() => { + handleCloseHistoryAsk() + askingData.value = { question, desLoading: true } + }) } const handleContinueAsk = (question) => { if (asking.value) return