feat: 修改会话历史获取图片结构
This commit is contained in:
@@ -374,9 +374,9 @@
|
||||
while (i < dialogue.length) {
|
||||
const item = dialogue[i]
|
||||
|
||||
if (item.image_url) {
|
||||
existingImgList.push(item.image_url)
|
||||
}
|
||||
// if (item.image_url) {
|
||||
// existingImgList.push(item.image_url)
|
||||
// }
|
||||
|
||||
if (item.role === 'user') {
|
||||
// user 角色直接添加
|
||||
@@ -394,9 +394,9 @@
|
||||
// 继续往后找连续的 assistant 消息
|
||||
let j = i + 1
|
||||
while (j < dialogue.length && dialogue[j].role === 'assistant') {
|
||||
if (dialogue[j].image_url) {
|
||||
existingImgList.push(dialogue[j].image_url)
|
||||
}
|
||||
// if (dialogue[j].image_url) {
|
||||
// existingImgList.push(dialogue[j].image_url)
|
||||
// }
|
||||
combinedContent += dialogue[j].content || ''
|
||||
j++
|
||||
}
|
||||
@@ -428,6 +428,7 @@
|
||||
const setChatInfo = (info) => {
|
||||
const initialData = agentStore.getInitialProjectData
|
||||
if (isGenerating.value || initialData) return
|
||||
console.log('info0----', info)
|
||||
|
||||
const data = info.conversation
|
||||
let project = info.project
|
||||
@@ -451,11 +452,12 @@
|
||||
|
||||
const { ancestors, current } = data
|
||||
|
||||
const imgList = []
|
||||
let imgList = []
|
||||
const ancestorsList = []
|
||||
let ancestorsIdCounter = 1
|
||||
if (ancestors) {
|
||||
ancestors.forEach((item) => {
|
||||
imgList = imgList.concat(current.sketchIDAndUrl)
|
||||
const list = processDialogue(item.dialogue, 0, imgList)
|
||||
// 重新设置 id
|
||||
list.forEach((el) => {
|
||||
@@ -465,7 +467,7 @@
|
||||
})
|
||||
}
|
||||
const currentList = processDialogue(current?.dialogue, 0, imgList)
|
||||
// 重新设置 id
|
||||
imgList = imgList.concat(current.sketchIDAndUrl)
|
||||
currentList.forEach((el, index) => {
|
||||
el.id = index + 1 + ancestorsList.length
|
||||
})
|
||||
@@ -475,7 +477,6 @@
|
||||
messageList.value = [...ancestorsList, ...currentList]
|
||||
params.versionID = current?.id
|
||||
sketchList.value = imgList
|
||||
console.log('11111111111111', params.versionID)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user