diff --git a/src/views/AI/chat/index.vue b/src/views/AI/chat/index.vue index 1ff77b9..5c75fae 100644 --- a/src/views/AI/chat/index.vue +++ b/src/views/AI/chat/index.vue @@ -215,19 +215,21 @@ const handleSend = async () => { // 更新 updataMessageItem({ from: 'ai', - text: '', + text: res.data, time: moment().format('YYYY/MM/DD HH:mm:ss'), loading: false, //ai思考中 chartInstanceItem: null, chartInstanceActiveIndex: 0, type: res.type, - xData: [], - data: [], + xData: res.xData, + data: res.data, title: res.title, unit: res.unit }) + nextTick(() => { + const itemData = messageList[lastIndex.value] //饼图 if (res.type === 'pie') { @@ -250,16 +252,6 @@ const handleSend = async () => { xData: res.xData, data: res.data }) - } else { - //纯文本 - updataMessageItem({ - from: 'ai', - title: res.title, - type: res.type, - text: res.data, - time: moment().format('YYYY/MM/DD HH:mm:ss'), - loading: false - }) } }) } catch { @@ -290,14 +282,14 @@ const initEcharts = (item, index) => { title: item.title, unit: item.unit, xData: item.xData, - data: item.yData + data: item.data }) } else if (item.type === 'line') { item.chartInstanceItem = new LineChart(`${item.type}${index}`, { title: item.title, unit: item.unit, xData: item.xData, - data: item.yData + data: item.data }) } }) diff --git a/src/views/AI/index.vue b/src/views/AI/index.vue index c3807cc..af26c86 100644 --- a/src/views/AI/index.vue +++ b/src/views/AI/index.vue @@ -66,7 +66,7 @@ const saveMessage = async path => { let res try { if (useMessageRoom.messageRoom.id) { - res = await historyMessageRoomUpdata({ content: jsonData, createUserId: useMessageRoom.messageRoom.id }) + res = await historyMessageRoomUpdata({ content: jsonData, id: useMessageRoom.messageRoom.id }) } else { res = await historyMessageRoom({ content: jsonData, createUserId: systemStore.userInfo.userId || 1 }) }