feat: 图片引用

This commit is contained in:
2026-03-24 16:57:40 +08:00
parent b1bf290c06
commit 0428783f5c
9 changed files with 79 additions and 28 deletions

View File

@@ -64,7 +64,8 @@
region: '',
style: ''
},
imageUrlList: []
imageUrlList: [],
quotaUrl: []
})
const sketchList = ref([])
@@ -110,7 +111,8 @@
text: initialData.text,
images: initialData.images,
useReport: initialData.useReport,
tempImages: initialData.tempImages
tempImages: initialData.tempImages,
quoteList: initialData.quoteList
})
// 更新 configParams
@@ -125,6 +127,7 @@
images: Array<{ url: string; name: string }>
tempImages: any[]
useReport: boolean
quoteList: Array<string>
},
skipUserMessage = false
) => {
@@ -136,14 +139,14 @@
}
params.imageUrlList = message.images || []
params.quotaUrl = message.quoteList || []
// 如果不是重新生成模式,则添加用户消息到列表
if (!skipUserMessage) {
messageList.value.push({
id: messageList.value.length + 1,
text: message.text,
isUser: true,
imageUrls: message.tempImages
imageUrls: message.tempImages.concat(message.quoteList)
})
}
@@ -223,6 +226,8 @@
let hasReportStarted = false // 标记 report 是否已经开始
let hasSketchEvent = false
let hasReportEvent = false
try {
let flag = true
while (flag) {
@@ -231,6 +236,9 @@
if (hasSketchEvent) {
aiMessage.text += `<slot slot-name="sketch"></slot>`
}
if (hasReportEvent) {
aiMessage.text += `<slot slot-name="card" title="Report" content="Report"></slot>`
}
aiMessage.streaming = false
aiMessage.loading = false
@@ -256,7 +264,8 @@
if (!hasReportStarted && eventName === 'report') {
isGeneratingReport.value = true
contentBody += `<slot slot-name="card" title="Report" content="Report"></slot>`
hasReportEvent = true
// contentBody += `<slot slot-name="card" title="Report" content="Report"></slot>`
hasReportStarted = true
}
@@ -588,7 +597,7 @@
nextTick(() => {
ancestorsList.forEach((item) => {
if (item.image_url) {
if (item.image_url && item.role !== 'user') {
item.text += `<slot slot-name="sketch"></slot>`
}
})