|
|
@@ -483,6 +483,7 @@ import { getApiPrefix, BACKEND_API_PREFIX } from '@/utils/apiConfig'
|
|
|
import { renderMarkdown } from '@/utils/markdown'
|
|
|
import { stopSSEStream, updateAIMessageContent } from '@/utils/api.js'
|
|
|
import {
|
|
|
+ applyReportChunkToMessage,
|
|
|
buildAIMessageUpdatePayload,
|
|
|
dedupeReportsByFileAndScene,
|
|
|
extractRelatedQuestions,
|
|
|
@@ -2591,8 +2592,9 @@ const handleSSEMessage = (data, aiMessageIndex) => {
|
|
|
break
|
|
|
|
|
|
case 'report_chunk':
|
|
|
- // 不再处理report_chunk,等待完整的report消息后用打字机效果显示
|
|
|
- // 这样可以避免与打字机效果冲突
|
|
|
+ if (applyReportChunkToMessage(aiMessage, streamingReports.value, data)) {
|
|
|
+ updateMessageStatus(aiMessage, 'deep_thinking')
|
|
|
+ }
|
|
|
break
|
|
|
|
|
|
case 'report':
|
|
|
@@ -2616,8 +2618,10 @@ const handleSSEMessage = (data, aiMessageIndex) => {
|
|
|
|
|
|
let targetReport
|
|
|
if (idx !== undefined) {
|
|
|
+ const existingReport = aiMessage.reports[idx]
|
|
|
+ const hadStreamingContent = Boolean(existingReport?._streamingStarted)
|
|
|
const displayCategory = reportData.metadata?.primary_category ||
|
|
|
- aiMessage.reports[idx].metadata?._displayCategory ||
|
|
|
+ existingReport?.metadata?._displayCategory ||
|
|
|
aiMessage.currentCategory
|
|
|
const fullSummary = reportData.report?.summary || ''
|
|
|
const fullAnalysis = reportData.report?.analysis || ''
|
|
|
@@ -2626,12 +2630,13 @@ const handleSSEMessage = (data, aiMessageIndex) => {
|
|
|
|
|
|
// 创建带空内容的报告对象,保留所有原始字段
|
|
|
aiMessage.reports[idx] = {
|
|
|
+ ...existingReport,
|
|
|
...reportData, // 保留所有原始字段,包括可能的链接字段
|
|
|
report: {
|
|
|
display_name: fullDisplayName, // 直接显示
|
|
|
- summary: '',
|
|
|
- analysis: '',
|
|
|
- clauses: ''
|
|
|
+ summary: hadStreamingContent ? fullSummary : '',
|
|
|
+ analysis: hadStreamingContent ? fullAnalysis : '',
|
|
|
+ clauses: hadStreamingContent ? fullClauses : ''
|
|
|
},
|
|
|
status: 'completed',
|
|
|
metadata: {
|
|
|
@@ -2643,7 +2648,8 @@ const handleSSEMessage = (data, aiMessageIndex) => {
|
|
|
summary: fullSummary,
|
|
|
analysis: fullAnalysis,
|
|
|
clauses: fullClauses
|
|
|
- }
|
|
|
+ },
|
|
|
+ _typewriterCompleted: hadStreamingContent || existingReport?._typewriterCompleted || false
|
|
|
}
|
|
|
targetReport = aiMessage.reports[idx]
|
|
|
streamingReports.value.delete(reportData.file_index)
|