可信代码库-AI大模型对于已经加入收藏的历史对话应该显示“取消收藏”

This commit is contained in:
付民康
2025-06-13 10:59:56 +08:00
parent 60352460cb
commit b3c1e9f159
2 changed files with 18 additions and 6 deletions

View File

@@ -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 {

View File

@@ -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(); // 调用子组件方法
}
})
};
// 刷新猜你想问