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)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,10 @@
|
||||
:key="'sketch-item-' + index"
|
||||
>
|
||||
<Menu class="menu-btn" @click="handleClickMenu" />
|
||||
<div class="edit-btn flex align-center space-between" @click="handleClickEdit">
|
||||
<div
|
||||
class="edit-btn flex align-center space-between"
|
||||
@click="handleClickEdit(item)"
|
||||
>
|
||||
<div>Edit</div>
|
||||
<img src="@/assets/images/arrow-top-right.png" />
|
||||
</div>
|
||||
@@ -124,6 +127,9 @@
|
||||
import Menu from './Menu.vue'
|
||||
import LoadingImg from '@/assets/images/sketch-loading.gif'
|
||||
import reportNull from '@/assets/images/reportNull.png'
|
||||
import myEvent from '@/utils/myEvent'
|
||||
import { useProjectStore } from '@/stores'
|
||||
const projectStore = useProjectStore()
|
||||
|
||||
// 存储每个图片的加载状态
|
||||
const loadedStatus = reactive<Record<number, boolean>>({})
|
||||
@@ -146,12 +152,19 @@
|
||||
|
||||
// 获取当前显示的图片源
|
||||
const getImageSrc = (item: string, index: number) => {
|
||||
return loadedStatus[index] ? item : LoadingImg
|
||||
if (typeof item === 'string') {
|
||||
return loadedStatus[index] ? item : LoadingImg
|
||||
}
|
||||
if (typeof item === 'object') {
|
||||
return Object.values(item)[0]
|
||||
}
|
||||
}
|
||||
|
||||
const handleClickEdit = () => {
|
||||
// 编辑按钮点击逻辑
|
||||
console.log('Edit button clicked')
|
||||
const handleClickEdit = (item: string) => {
|
||||
const url = Object.values(item)[0]
|
||||
const imgId = Object.keys(item)[0]
|
||||
const nodeId = projectStore.state.nodeId
|
||||
myEvent.emit('openFlowCanvas', { url, imgId, nodeId })
|
||||
}
|
||||
const handleClickMenu = () => {
|
||||
// 菜单按钮点击逻辑
|
||||
|
||||
Reference in New Issue
Block a user