From 920fb5aa951828492ba4612be58765b61db996bd Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 1 Feb 2026 02:04:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=BB=B6=E8=BF=9F?= =?UTF-8?q?=E8=AE=A9=E5=89=8D=E7=AB=AF=E6=B8=B2=E6=9F=93=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在发送对话消息后等待500ms,让前端有时间渲染第一条消息, 然后再开始第二轮(图片生成),这样不会在同一个回复里重叠 Co-authored-by: Cursor --- app/(chat)/api/chat/route.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/(chat)/api/chat/route.ts b/app/(chat)/api/chat/route.ts index 115366aa9..ece237cd6 100644 --- a/app/(chat)/api/chat/route.ts +++ b/app/(chat)/api/chat/route.ts @@ -991,7 +991,7 @@ export async function POST(request: Request) { const chatMessageId = generateUUID(); console.log("[Chat API] 💬 Sending conversational reply first:", smartAutoFriendlyMessage); - // 立即发送对话消息 + // 发送对话消息 writer.write({ type: "data-appendMessage", data: JSON.stringify({ @@ -1014,6 +1014,9 @@ export async function POST(request: Request) { }, ], }); + + // 🆕 给前端一点时间渲染第一条消息 + await new Promise(resolve => setTimeout(resolve, 500)); } // 只传递最后一条用户消息 @@ -1205,7 +1208,7 @@ export async function POST(request: Request) { const chatMessageId = generateUUID(); console.log("[Chat API] 💬 Volcano: Sending conversational reply first:", smartAutoFriendlyMessage); - // 立即发送对话消息 + // 发送对话消息 writer.write({ type: "data-appendMessage", data: JSON.stringify({ @@ -1228,6 +1231,9 @@ export async function POST(request: Request) { }, ], }); + + // 🆕 给前端一点时间渲染第一条消息 + await new Promise(resolve => setTimeout(resolve, 500)); } // 转换消息,火山引擎支持 URL 和 base64