debug: 添加消息数组追踪日志
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Your Name 2026-02-01 02:40:20 +08:00
parent fbe797d436
commit 1dd9500f22

View File

@ -283,6 +283,20 @@ function PureMessages({
prevMessagesLengthRef.current = messages.length;
}, [messages, scrollToBottom]);
// 🔍 调试:追踪消息数组变化
useEffect(() => {
console.log("[Messages] 📋 消息数组更新:", {
count: messages.length,
messages: messages.map(m => ({
id: m.id?.substring(0, 8),
role: m.role,
partsCount: m.parts?.length,
firstPartType: m.parts?.[0]?.type,
firstPartText: m.parts?.[0]?.type === "text" ? m.parts[0].text?.substring(0, 50) : undefined
}))
});
}, [messages]);
return (
<div className="relative flex-1">
<div