feat: 实时对话的报告
This commit is contained in:
@@ -146,6 +146,7 @@
|
||||
id: messageList.value.length + 1,
|
||||
text: '',
|
||||
isUser: false,
|
||||
sessionId: 'projectStore.state.id',
|
||||
loading: true,
|
||||
thinking: false,
|
||||
thinkingText: '',
|
||||
@@ -214,7 +215,8 @@
|
||||
if (!reader) throw new Error('无法获取流读取器')
|
||||
|
||||
const decoder = new TextDecoder()
|
||||
|
||||
let previousEventName = '' // 记录上一个事件名称
|
||||
let hasReportStarted = false // 标记 report 是否已经开始
|
||||
try {
|
||||
let flag = true
|
||||
while (flag) {
|
||||
@@ -234,9 +236,6 @@
|
||||
let events = buffer.split(/\n\n/)
|
||||
buffer = events.pop() // 保留不完整块
|
||||
|
||||
let previousEventName = '' // 记录上一个事件名称
|
||||
let hasReportStarted = false // 标记 report 是否已经开始
|
||||
|
||||
for (let event of events) {
|
||||
if (!event.trim()) continue
|
||||
|
||||
@@ -262,7 +261,10 @@
|
||||
reportsContent.value
|
||||
) {
|
||||
isGeneratingReport.value = false
|
||||
localStorage.setItem('reportsContent', reportsContent.value)
|
||||
localStorage.setItem(
|
||||
'reportsContent_' + projectStore.state.id,
|
||||
reportsContent.value
|
||||
)
|
||||
}
|
||||
|
||||
previousEventName = eventName
|
||||
@@ -323,7 +325,7 @@
|
||||
})
|
||||
}
|
||||
if (eventName === 'report') {
|
||||
reportsContent.value += jsonData.content
|
||||
reportsContent.value += jsonData.report
|
||||
} else {
|
||||
if (jsonData.reasoning) {
|
||||
aiMessage.thinking = true
|
||||
|
||||
Reference in New Issue
Block a user