feat: 报告标题
This commit is contained in:
@@ -320,10 +320,6 @@
|
||||
params.versionID = versionID
|
||||
projectStore.setProject({ nodeId: versionID })
|
||||
}
|
||||
// if (eventName === 'webAddress') {
|
||||
// console.log('webAddress111111111111111', eventName, dataLines)
|
||||
// debugger
|
||||
// }
|
||||
|
||||
if (eventName === 'tool') {
|
||||
MyEvent.emit('loading-sketch', sketchList.value.length)
|
||||
@@ -354,6 +350,9 @@
|
||||
MyEvent.emit('OpenSketch')
|
||||
// contentBody += `<slot slot-name="sketch"></slot>`
|
||||
}
|
||||
if (eventName === 'reportName' || eventName === 'reportTitle') {
|
||||
aiMessage.reportName = jsonData.reportName || jsonData.reportTitle
|
||||
}
|
||||
if (eventName === 'report') {
|
||||
reportsContent.value += jsonData.report
|
||||
} else {
|
||||
@@ -492,9 +491,11 @@
|
||||
i++
|
||||
} else if (item.role === 'assistant') {
|
||||
// assistant 角色,拼接直到下一个 user
|
||||
|
||||
let combinedContent = item.content || ''
|
||||
let combinedThinkingText = item.reasoning || ''
|
||||
let combinedImageUrl = item.image_url || null
|
||||
let reportName = item.reportName || null
|
||||
// 继续往后找连续的 assistant 消息
|
||||
let j = i + 1
|
||||
while (j < dialogue.length && dialogue[j].role === 'assistant') {
|
||||
@@ -504,6 +505,9 @@
|
||||
if (dialogue[j].image_url) {
|
||||
combinedImageUrl = dialogue[j].image_url
|
||||
}
|
||||
if (dialogue[j].reportName) {
|
||||
reportName = dialogue[j].reportName
|
||||
}
|
||||
j++
|
||||
}
|
||||
|
||||
@@ -514,6 +518,7 @@
|
||||
|
||||
result.push({
|
||||
...item,
|
||||
reportName,
|
||||
content: combinedContent,
|
||||
thinkingText: combinedThinkingText,
|
||||
text: combinedContent,
|
||||
@@ -618,7 +623,6 @@
|
||||
item.text += `<slot slot-name="sketch"></slot>`
|
||||
}
|
||||
})
|
||||
|
||||
messageList.value = [...ancestorsList]
|
||||
params.versionID = current?.id
|
||||
sketchList.value = imgList
|
||||
|
||||
@@ -56,7 +56,10 @@
|
||||
:rehype-plugins="[rehypeRaw]"
|
||||
>
|
||||
<template v-slot:s-card="{ children: children, ...attrs }">
|
||||
<Card :title="attrs.title" @click.native="handleClickReport" />
|
||||
<Card
|
||||
:title="content.reportName ?? attrs.title"
|
||||
@click.native="handleClickReport"
|
||||
/>
|
||||
</template>
|
||||
<template v-slot:s-url="{ children: children }">
|
||||
<Url :list="content.webAddress" @click.native="handleClickUrls" />
|
||||
@@ -261,7 +264,7 @@
|
||||
}
|
||||
|
||||
const handleClickReport = () => {
|
||||
MyEvent.emit('openReport', props.content.sessionId)
|
||||
MyEvent.emit('openReport', props.content)
|
||||
// 点击显示报告
|
||||
}
|
||||
const handleClickUrls = (data) => {
|
||||
|
||||
@@ -163,10 +163,17 @@
|
||||
const markdownContent = ref('')
|
||||
const urlList = ref([])
|
||||
const reportType = ref<'report' | 'urls'>('report')
|
||||
const reportTitle = ref('')
|
||||
|
||||
const setSessionId = (id: string) => {
|
||||
reportType.value = 'report'
|
||||
sessionId.value = id
|
||||
}
|
||||
|
||||
const setReportTitle = (title: string) => {
|
||||
reportTitle.value = title
|
||||
}
|
||||
|
||||
const setUrls = async (list: string[]) => {
|
||||
reportType.value = 'urls'
|
||||
const res = await fetchUrlTitle(list)
|
||||
@@ -246,7 +253,7 @@
|
||||
const url = URL.createObjectURL(blob)
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = `report-${Date.now()}.md`
|
||||
link.download = reportTitle.value ?? `report-${Date.now()}.md`
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
@@ -299,7 +306,8 @@
|
||||
|
||||
defineExpose({
|
||||
setSessionId,
|
||||
setUrls
|
||||
setUrls,
|
||||
setReportTitle
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user