提示词保存
This commit is contained in:
@@ -211,7 +211,12 @@ export async function streamChat(options = {}) {
|
||||
return
|
||||
}
|
||||
|
||||
// 获取内容片段
|
||||
// 忽略只有 send 没有 receive 的消息(用户消息确认,不需要处理内容)
|
||||
if (responseData.send && !responseData.receive) {
|
||||
return
|
||||
}
|
||||
|
||||
// 获取 AI 回复的内容片段(增量更新,需要累加)
|
||||
const piece = responseData.receive?.content || responseData.receive?.reasoningContent || ''
|
||||
if (piece) {
|
||||
fullText += piece
|
||||
@@ -222,7 +227,11 @@ export async function streamChat(options = {}) {
|
||||
// 兼容其他格式
|
||||
try {
|
||||
const obj = JSON.parse(dataStr)
|
||||
const piece = obj?.content || obj?.data || obj?.text || ''
|
||||
// 跳过只有 send 的消息
|
||||
if (obj?.data?.send && !obj?.data?.receive) {
|
||||
return
|
||||
}
|
||||
const piece = obj?.content || obj?.data?.receive?.content || obj?.text || ''
|
||||
if (piece) {
|
||||
fullText += piece
|
||||
smoothUpdate(fullText)
|
||||
|
||||
Reference in New Issue
Block a user