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