From b3c1e9f1591633ae0917a03e03ee041438d7b4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E6=B0=91=E5=BA=B7?= Date: Fri, 13 Jun 2025 10:59:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BF=A1=E4=BB=A3=E7=A0=81=E5=BA=93-A?= =?UTF-8?q?I=E5=A4=A7=E6=A8=A1=E5=9E=8B=E5=AF=B9=E4=BA=8E=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=8A=A0=E5=85=A5=E6=94=B6=E8=97=8F=E7=9A=84=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E5=AF=B9=E8=AF=9D=E5=BA=94=E8=AF=A5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E2=80=9C=E5=8F=96=E6=B6=88=E6=94=B6=E8=97=8F=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewHistoryAside/ViewHistoryAside.vue | 16 +++++++++++----- src/views/Jyh/AI/Home/index.vue | 8 +++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue b/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue index 022f1a7..10a8b6a 100644 --- a/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue +++ b/src/views/Jyh/AI/Home/components/ViewHistoryAside/ViewHistoryAside.vue @@ -263,7 +263,6 @@ const { formatTime } = useTimeFormat(); // 监听historyLimit变化,更新page.size并重置页码 const handleHistoryLimitChange = (val) => { - debugger page.value.size = Number(val) || Infinity; // 0转换为Infinity表示不限 page.value.pageNum = 1; // 重置为第一页 loadData(); // 重新加载数据 @@ -343,11 +342,18 @@ const toggleCollect = async (item) => { }); if (res.data.code === 20000) { - // 更新历史对话状态 - item.is_collected = res.data.isCollected; + // // 确保is_collected是响应式的 + // const isCollected = res.data.isCollected; + // // 找到对应的项并更新(使用索引确保响应式更新) + // const list = selectTab.value === 'dhls' ? dhlsList.value : collectionList.value; + // const index = list.findIndex(i => i.conversationId === item.conversationId); - // 刷新收藏列表 - await getQuestionCollection(); + // if (index !== -1) { + // // 使用Vue的响应式更新方式 + // list[index].is_collected = isCollected; + // } + + await loadData() Message.success(res.data.message); } else { diff --git a/src/views/Jyh/AI/Home/index.vue b/src/views/Jyh/AI/Home/index.vue index 08a3d93..f19cb91 100644 --- a/src/views/Jyh/AI/Home/index.vue +++ b/src/views/Jyh/AI/Home/index.vue @@ -394,6 +394,7 @@ const createConversation = async () => { const createRes = response.data; if (createRes&&createRes.conversationId) { + debugger CONV_ID.value = createRes.conversationId; console.log('创建会话成功,会话ID:', CONV_ID.value); nextTick(() => { @@ -423,7 +424,6 @@ const fetchFollowupQuestions = async (question,df_id,sql_id='') => { `${VITE_AI_API_HOST}/api/v0/provide_followup_questions`, params ); - debugger const createRes = response.data; if (createRes&&createRes.questions) { followupQuestions.value = createRes.questions @@ -440,6 +440,12 @@ const fetchFollowupQuestions = async (question,df_id,sql_id='') => { behavior: 'smooth', }); }); + nextTick(() => { + // 刷新会话列表 + if (viewHistoryRef.value) { + viewHistoryRef.value.getQuestionHistory(); // 调用子组件方法 + } + }) }; // 刷新猜你想问