bugfix: restore会话历史
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
import Input from '../../components/Input.vue'
|
||||
import { fetchAgentReply } from '@/api/agent'
|
||||
import type { AgentParamsType } from '@/api/agent'
|
||||
import { useUserInfoStore, useProjectStore, } from '@/stores'
|
||||
import { useUserInfoStore, useProjectStore } from '@/stores'
|
||||
import { useAgentStore } from '@/stores/agent'
|
||||
|
||||
const userStore = useUserInfoStore()
|
||||
@@ -367,7 +367,8 @@
|
||||
const ancestorsList = []
|
||||
if (ancestors) {
|
||||
ancestors.forEach((item) => {
|
||||
const list = item.dialogue.map((el, index) => {
|
||||
const list =
|
||||
item.dialogue?.map((el, index) => {
|
||||
if (el.image_url) {
|
||||
imgList.push(el.image_url)
|
||||
}
|
||||
@@ -377,11 +378,12 @@
|
||||
isUser: el.role === 'user',
|
||||
id: index + 1
|
||||
}
|
||||
})
|
||||
}) || []
|
||||
ancestorsList.push(...list)
|
||||
})
|
||||
}
|
||||
const currentList = current.dialogue.map((item, index) => {
|
||||
const currentList =
|
||||
current?.dialogue?.map((item, index) => {
|
||||
if (item.image_url) {
|
||||
imgList.push(item.image_url)
|
||||
}
|
||||
@@ -391,7 +393,8 @@
|
||||
isUser: item.role === 'user',
|
||||
id: index + 1 + ancestorsList.length
|
||||
}
|
||||
})
|
||||
}) || []
|
||||
|
||||
messageList.value = [...ancestorsList, ...currentList]
|
||||
params.versionID = current.id
|
||||
sketchList.value = imgList
|
||||
|
||||
@@ -49,7 +49,9 @@
|
||||
const handleRestore = () => {
|
||||
// agentRef.value?.inputRef?.addReportTag('Restore')
|
||||
clearNodeChat({ projectId: projectStore.state.id, id: projectStore.state.nodeId }).then(
|
||||
(res) => {}
|
||||
(res) => {
|
||||
agentRef.value.setChatInfo(res)
|
||||
}
|
||||
)
|
||||
}
|
||||
const handleSelectNode = () => {
|
||||
@@ -68,7 +70,7 @@
|
||||
let data = res?.project || res
|
||||
if (data?.latestNodeId) data.nodeId = data.latestNodeId
|
||||
projectStore.setProject({
|
||||
...data,
|
||||
...data
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user