feat: 修改会话历史获取图片结构
This commit is contained in:
@@ -374,9 +374,9 @@
|
|||||||
while (i < dialogue.length) {
|
while (i < dialogue.length) {
|
||||||
const item = dialogue[i]
|
const item = dialogue[i]
|
||||||
|
|
||||||
if (item.image_url) {
|
// if (item.image_url) {
|
||||||
existingImgList.push(item.image_url)
|
// existingImgList.push(item.image_url)
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (item.role === 'user') {
|
if (item.role === 'user') {
|
||||||
// user 角色直接添加
|
// user 角色直接添加
|
||||||
@@ -394,9 +394,9 @@
|
|||||||
// 继续往后找连续的 assistant 消息
|
// 继续往后找连续的 assistant 消息
|
||||||
let j = i + 1
|
let j = i + 1
|
||||||
while (j < dialogue.length && dialogue[j].role === 'assistant') {
|
while (j < dialogue.length && dialogue[j].role === 'assistant') {
|
||||||
if (dialogue[j].image_url) {
|
// if (dialogue[j].image_url) {
|
||||||
existingImgList.push(dialogue[j].image_url)
|
// existingImgList.push(dialogue[j].image_url)
|
||||||
}
|
// }
|
||||||
combinedContent += dialogue[j].content || ''
|
combinedContent += dialogue[j].content || ''
|
||||||
j++
|
j++
|
||||||
}
|
}
|
||||||
@@ -428,6 +428,7 @@
|
|||||||
const setChatInfo = (info) => {
|
const setChatInfo = (info) => {
|
||||||
const initialData = agentStore.getInitialProjectData
|
const initialData = agentStore.getInitialProjectData
|
||||||
if (isGenerating.value || initialData) return
|
if (isGenerating.value || initialData) return
|
||||||
|
console.log('info0----', info)
|
||||||
|
|
||||||
const data = info.conversation
|
const data = info.conversation
|
||||||
let project = info.project
|
let project = info.project
|
||||||
@@ -451,11 +452,12 @@
|
|||||||
|
|
||||||
const { ancestors, current } = data
|
const { ancestors, current } = data
|
||||||
|
|
||||||
const imgList = []
|
let imgList = []
|
||||||
const ancestorsList = []
|
const ancestorsList = []
|
||||||
let ancestorsIdCounter = 1
|
let ancestorsIdCounter = 1
|
||||||
if (ancestors) {
|
if (ancestors) {
|
||||||
ancestors.forEach((item) => {
|
ancestors.forEach((item) => {
|
||||||
|
imgList = imgList.concat(current.sketchIDAndUrl)
|
||||||
const list = processDialogue(item.dialogue, 0, imgList)
|
const list = processDialogue(item.dialogue, 0, imgList)
|
||||||
// 重新设置 id
|
// 重新设置 id
|
||||||
list.forEach((el) => {
|
list.forEach((el) => {
|
||||||
@@ -465,7 +467,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const currentList = processDialogue(current?.dialogue, 0, imgList)
|
const currentList = processDialogue(current?.dialogue, 0, imgList)
|
||||||
// 重新设置 id
|
imgList = imgList.concat(current.sketchIDAndUrl)
|
||||||
currentList.forEach((el, index) => {
|
currentList.forEach((el, index) => {
|
||||||
el.id = index + 1 + ancestorsList.length
|
el.id = index + 1 + ancestorsList.length
|
||||||
})
|
})
|
||||||
@@ -475,7 +477,6 @@
|
|||||||
messageList.value = [...ancestorsList, ...currentList]
|
messageList.value = [...ancestorsList, ...currentList]
|
||||||
params.versionID = current?.id
|
params.versionID = current?.id
|
||||||
sketchList.value = imgList
|
sketchList.value = imgList
|
||||||
console.log('11111111111111', params.versionID)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,10 @@
|
|||||||
:key="'sketch-item-' + index"
|
:key="'sketch-item-' + index"
|
||||||
>
|
>
|
||||||
<Menu class="menu-btn" @click="handleClickMenu" />
|
<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>
|
<div>Edit</div>
|
||||||
<img src="@/assets/images/arrow-top-right.png" />
|
<img src="@/assets/images/arrow-top-right.png" />
|
||||||
</div>
|
</div>
|
||||||
@@ -124,6 +127,9 @@
|
|||||||
import Menu from './Menu.vue'
|
import Menu from './Menu.vue'
|
||||||
import LoadingImg from '@/assets/images/sketch-loading.gif'
|
import LoadingImg from '@/assets/images/sketch-loading.gif'
|
||||||
import reportNull from '@/assets/images/reportNull.png'
|
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>>({})
|
const loadedStatus = reactive<Record<number, boolean>>({})
|
||||||
@@ -146,12 +152,19 @@
|
|||||||
|
|
||||||
// 获取当前显示的图片源
|
// 获取当前显示的图片源
|
||||||
const getImageSrc = (item: string, index: number) => {
|
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 = () => {
|
const handleClickEdit = (item: string) => {
|
||||||
// 编辑按钮点击逻辑
|
const url = Object.values(item)[0]
|
||||||
console.log('Edit button clicked')
|
const imgId = Object.keys(item)[0]
|
||||||
|
const nodeId = projectStore.state.nodeId
|
||||||
|
myEvent.emit('openFlowCanvas', { url, imgId, nodeId })
|
||||||
}
|
}
|
||||||
const handleClickMenu = () => {
|
const handleClickMenu = () => {
|
||||||
// 菜单按钮点击逻辑
|
// 菜单按钮点击逻辑
|
||||||
|
|||||||
Reference in New Issue
Block a user