feat: 修改markdown格式化&实时对话sketch
This commit is contained in:
@@ -252,17 +252,22 @@
|
||||
if (event.includes('todo') || event.includes('webAddress')) {
|
||||
break
|
||||
}
|
||||
let hasSketch = false
|
||||
if (event.includes('sketchIDAndUrl')) {
|
||||
hasSketch = true
|
||||
}
|
||||
|
||||
const dataLines = event
|
||||
.split(/\n/)
|
||||
.filter((line) => line.startsWith('data:'))
|
||||
.map((line) => line.replace(/^data:\s*/, '').trim())
|
||||
.filter((content) => content.startsWith('{') || content.startsWith('['))
|
||||
const dataLines = event
|
||||
.split(/\n/)
|
||||
.filter((line) => line.startsWith('data:'))
|
||||
.map((line) => line.replace(/^data:\s*/, '').trim())
|
||||
.filter((content) => content.startsWith('{') || content.startsWith('['))
|
||||
// console.log('dataLInes', dataLines)
|
||||
if (isNodeIdEvent) {
|
||||
params.versionID = dataLines[0]
|
||||
projectStore.setProject({ nodeId: dataLines[0] })
|
||||
}
|
||||
|
||||
if (event.includes('tool')) {
|
||||
MyEvent.emit('loading-sketch')
|
||||
}
|
||||
@@ -274,11 +279,10 @@
|
||||
const jsonData = JSON.parse(jsonText)
|
||||
console.log('jsonData', jsonData)
|
||||
|
||||
// 赋值 project_id 和 version_id
|
||||
// if (jsonData.project_id) params.projectID = jsonData.project_id
|
||||
// if (jsonData.version_id) params.versionID = jsonData.version_id
|
||||
if (jsonData.image_url) {
|
||||
sketchList.value.push(jsonData.image_url)
|
||||
if (hasSketch) {
|
||||
sketchList.value.push({
|
||||
[Object.keys(jsonData)[0]]: jsonData[Object.keys(jsonData)[0]]
|
||||
})
|
||||
}
|
||||
if (
|
||||
jsonData.content &&
|
||||
@@ -382,10 +386,6 @@
|
||||
while (i < dialogue.length) {
|
||||
const item = dialogue[i]
|
||||
|
||||
// if (item.image_url) {
|
||||
// existingImgList.push(item.image_url)
|
||||
// }
|
||||
|
||||
if (item.role === 'user') {
|
||||
// user 角色直接添加
|
||||
result.push({
|
||||
@@ -402,9 +402,6 @@
|
||||
// 继续往后找连续的 assistant 消息
|
||||
let j = i + 1
|
||||
while (j < dialogue.length && dialogue[j].role === 'assistant') {
|
||||
// if (dialogue[j].image_url) {
|
||||
// existingImgList.push(dialogue[j].image_url)
|
||||
// }
|
||||
combinedContent += dialogue[j].content || ''
|
||||
j++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user