可信代码库-AI大模型bug修复及相关功能修改(暂时不升级,需还原)
This commit is contained in:
@@ -295,7 +295,6 @@ const dhlsList = ref([]);
|
|||||||
|
|
||||||
// 选择卡片
|
// 选择卡片
|
||||||
const selectCard = (item) => {
|
const selectCard = (item) => {
|
||||||
debugger
|
|
||||||
selectedIndex.value = item.id;
|
selectedIndex.value = item.id;
|
||||||
// 这里可以添加选中后的其他逻辑
|
// 这里可以添加选中后的其他逻辑
|
||||||
// console.log('选中卡片:', cardList.value[index]);
|
// console.log('选中卡片:', cardList.value[index]);
|
||||||
@@ -306,7 +305,6 @@ const getQuestionHistory = async (content) => {
|
|||||||
/*TODO:缺少用户名入参*/
|
/*TODO:缺少用户名入参*/
|
||||||
const {data} = await axios.get(VITE_AI_API_HOST + '/api/conversationList?userId=?');
|
const {data} = await axios.get(VITE_AI_API_HOST + '/api/conversationList?userId=?');
|
||||||
if(data.questions) {
|
if(data.questions) {
|
||||||
debugger
|
|
||||||
dhlsList.value = data.questions
|
dhlsList.value = data.questions
|
||||||
} else {
|
} else {
|
||||||
Message.warning('接口异常!')
|
Message.warning('接口异常!')
|
||||||
|
|||||||
@@ -39,10 +39,10 @@
|
|||||||
size="md"
|
size="md"
|
||||||
:page-size="dhlsPagination.size"
|
:page-size="dhlsPagination.size"
|
||||||
:total="dhlsPagination.total"
|
:total="dhlsPagination.total"
|
||||||
v-model:current-page="dhlsPagination.page"
|
v-model:pageIndex="dhlsPagination.page"
|
||||||
:page-size-options="[10, 20, 50]"
|
:page-size-options="[10, 20, 50]"
|
||||||
@page-size-change="(num)=>handlePageSizeChange('scdh', num)"
|
@page-size-change="handlePageSizeChange"
|
||||||
@current-page-change="(num)=>handlePageChange('scdh', num)"
|
@page-index-change="handlePageChange"
|
||||||
total-item-text="总计"
|
total-item-text="总计"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<d-icon
|
<d-icon
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
@click="handleDelete([scope.row.conversationId], 'collection')"
|
@click="toggleCollect([scope.row.conversationId], 'collection')"
|
||||||
name="delete"
|
name="delete"
|
||||||
></d-icon>
|
></d-icon>
|
||||||
</template>
|
</template>
|
||||||
@@ -261,25 +261,21 @@ const handleSearch = async (tabType) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 分页大小变化
|
// 分页大小变化
|
||||||
const handlePageSizeChange = async (size) => {
|
const handlePageSizeChange = async () => {
|
||||||
let tabType = selectTab.value
|
let tabType = selectTab.value
|
||||||
debugger
|
|
||||||
if (tabType === 'dhls') {
|
if (tabType === 'dhls') {
|
||||||
dhlsPagination.value.size = size;
|
|
||||||
dhlsPagination.value.page = 1; // 重置到第一页
|
dhlsPagination.value.page = 1; // 重置到第一页
|
||||||
await getQuestionHistory();
|
await getQuestionHistory();
|
||||||
} else {
|
} else {
|
||||||
collectionPagination.value.size = size;
|
|
||||||
collectionPagination.value.page = 1; // 重置到第一页
|
collectionPagination.value.page = 1; // 重置到第一页
|
||||||
await getQuestionCollection();
|
await getQuestionCollection();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 页码变化
|
// 页码变化
|
||||||
const handlePageChange = async (page) => {
|
const handlePageChange = async () => {
|
||||||
let tabType = selectTab.value
|
let tabType = selectTab.value
|
||||||
if (tabType === 'dhls') {
|
if (tabType === 'dhls') {
|
||||||
dhlsPagination.value.page = page;
|
|
||||||
await getQuestionHistory();
|
await getQuestionHistory();
|
||||||
} else {
|
} else {
|
||||||
collectionPagination.value.page = page;
|
collectionPagination.value.page = page;
|
||||||
@@ -315,7 +311,7 @@ const handleDelete = async (conversationIds) => {
|
|||||||
conversationIdList: conversationIds
|
conversationIdList: conversationIds
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (res.data.code === 20000) {
|
if (res.data.code === 200) {
|
||||||
Message.success(res.data.message || '删除成功');
|
Message.success(res.data.message || '删除成功');
|
||||||
// 刷新当前标签页的数据
|
// 刷新当前标签页的数据
|
||||||
initData()
|
initData()
|
||||||
@@ -342,7 +338,7 @@ const toggleCollect = async (conversationIds) => {
|
|||||||
conversationIdList: conversationIds
|
conversationIdList: conversationIds
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.data.code === 20000) {
|
if (res.data.code === 200) {
|
||||||
Message.success(res.data.message || '取消收藏成功');
|
Message.success(res.data.message || '取消收藏成功');
|
||||||
// 刷新当前标签页的数据
|
// 刷新当前标签页的数据
|
||||||
initData()
|
initData()
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ const confirmEdit = async (item) => {
|
|||||||
newTitle: item.tempTitle
|
newTitle: item.tempTitle
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.data.code === 20000 ||res.data.code === 20001||res.data.code === 200) {
|
if (res.data.code === 200 ||res.data.code === 20001||res.data.code === 200) {
|
||||||
item.title = item.tempTitle; // 更新标题
|
item.title = item.tempTitle; // 更新标题
|
||||||
item.isEditing = false; // 退出编辑状态
|
item.isEditing = false; // 退出编辑状态
|
||||||
Message.success('标题修改成功');
|
Message.success('标题修改成功');
|
||||||
@@ -341,7 +341,7 @@ const toggleCollect = async (item) => {
|
|||||||
conversationIdList: [item.conversationId]
|
conversationIdList: [item.conversationId]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res.data.code === 20000) {
|
if (res.data.code === 200) {
|
||||||
// // 确保is_collected是响应式的
|
// // 确保is_collected是响应式的
|
||||||
// const isCollected = res.data.isCollected;
|
// const isCollected = res.data.isCollected;
|
||||||
// // 找到对应的项并更新(使用索引确保响应式更新)
|
// // 找到对应的项并更新(使用索引确保响应式更新)
|
||||||
@@ -414,9 +414,9 @@ const getQuestionHistory = async () => {
|
|||||||
"size": page.value.size,
|
"size": page.value.size,
|
||||||
"search": searchText.value
|
"search": searchText.value
|
||||||
});
|
});
|
||||||
|
debugger
|
||||||
if(data.conversationList) {
|
if(data.data) {
|
||||||
dhlsList.value = data.conversationList
|
dhlsList.value = data.data
|
||||||
} else {
|
} else {
|
||||||
// Message.error(data.error||'接口异常!')
|
// Message.error(data.error||'接口异常!')
|
||||||
}
|
}
|
||||||
@@ -434,8 +434,8 @@ const getQuestionCollection = async () => {
|
|||||||
"size": page.value.size,
|
"size": page.value.size,
|
||||||
"search": searchText.value
|
"search": searchText.value
|
||||||
});
|
});
|
||||||
if(data.conversationList) {
|
if(data.data) {
|
||||||
collectionList.value = data.conversationList
|
collectionList.value = data.data
|
||||||
} else {
|
} else {
|
||||||
// Message.error(data.error||'接口异常!')
|
// Message.error(data.error||'接口异常!')
|
||||||
}
|
}
|
||||||
@@ -459,7 +459,7 @@ const handleDelete = async (conversationIds, tabType) => {
|
|||||||
conversationIdList: conversationIds
|
conversationIdList: conversationIds
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (res.data.code === 20000) {
|
if (res.data.code === 200) {
|
||||||
Message.success(res.data.message || '删除成功');
|
Message.success(res.data.message || '删除成功');
|
||||||
loadData()
|
loadData()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -345,8 +345,8 @@ const getAIAnswer = async (content) => {
|
|||||||
|
|
||||||
debugger
|
debugger
|
||||||
|
|
||||||
if(response.data.type) {
|
if(response.data.data.type) {
|
||||||
const {text,type,id,table_name=[], states={}} = response.data;
|
const {text,type,id,table_name=[], states={}} = response.data.data;
|
||||||
messages.value[messages.value.length - 1].id = id;
|
messages.value[messages.value.length - 1].id = id;
|
||||||
// 处理思考过程
|
// 处理思考过程
|
||||||
const thinkProcess = processThinkStates(states);
|
const thinkProcess = processThinkStates(states);
|
||||||
@@ -358,13 +358,13 @@ const getAIAnswer = async (content) => {
|
|||||||
messages.value[messages.value.length - 1].loading = false;
|
messages.value[messages.value.length - 1].loading = false;
|
||||||
messages.value[messages.value.length - 1].type = 'text';
|
messages.value[messages.value.length - 1].type = 'text';
|
||||||
} else if(type==='df') {
|
} else if(type==='df') {
|
||||||
messages.value[messages.value.length - 1].content = response.data[type];
|
messages.value[messages.value.length - 1].content = response.data.data[type];
|
||||||
messages.value[messages.value.length - 1].loading = false;
|
messages.value[messages.value.length - 1].loading = false;
|
||||||
messages.value[messages.value.length - 1].type = 'df';
|
messages.value[messages.value.length - 1].type = 'df';
|
||||||
|
|
||||||
// 判断是否软件详情
|
// 判断是否软件详情
|
||||||
if(table_name.length===1&&table_name[0]==='critical_software_info') {
|
if(table_name.length===1&&table_name[0]==='critical_software_info') {
|
||||||
let arr = JSON.parse(response.data[type]);
|
let arr = JSON.parse(response.data.data[type]);
|
||||||
if(arr&&arr.length===1) {
|
if(arr&&arr.length===1) {
|
||||||
messages.value[messages.value.length - 1].type = 'critical_software_info';
|
messages.value[messages.value.length - 1].type = 'critical_software_info';
|
||||||
messages.value[messages.value.length - 1].id = arr[0]?.id || arr[0]?.ID;
|
messages.value[messages.value.length - 1].id = arr[0]?.id || arr[0]?.ID;
|
||||||
@@ -372,7 +372,7 @@ const getAIAnswer = async (content) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(type==='sql_error') {
|
} else if(type==='sql_error') {
|
||||||
messages.value[messages.value.length - 1].content = response.data.error;
|
messages.value[messages.value.length - 1].content = response.data.data.error;
|
||||||
messages.value[messages.value.length - 1].loading = false;
|
messages.value[messages.value.length - 1].loading = false;
|
||||||
messages.value[messages.value.length - 1].type = 'error';
|
messages.value[messages.value.length - 1].type = 'error';
|
||||||
}
|
}
|
||||||
@@ -433,8 +433,8 @@ const createConversation = async () => {
|
|||||||
const response = await axios.post(`${VITE_AI_API_HOST}/api/createConversation`, {
|
const response = await axios.post(`${VITE_AI_API_HOST}/api/createConversation`, {
|
||||||
userId: username,
|
userId: username,
|
||||||
});
|
});
|
||||||
const createRes = response.data;
|
const createRes = response.data.data;
|
||||||
|
debugger
|
||||||
if (createRes&&createRes.conversationId) {
|
if (createRes&&createRes.conversationId) {
|
||||||
debugger
|
debugger
|
||||||
CONV_ID.value = createRes.conversationId;
|
CONV_ID.value = createRes.conversationId;
|
||||||
@@ -513,7 +513,7 @@ const getConversationDetail = async (convId: string) => {
|
|||||||
conversationId: convId,
|
conversationId: convId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const detail = response.data.messages;
|
const detail = response.data.data;
|
||||||
// 处理详情数据(如回显消息列表)
|
// 处理详情数据(如回显消息列表)
|
||||||
handleDetailResponse(detail);
|
handleDetailResponse(detail);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user