From f714645b0c61cc2a95bc1eb04653cc0c07ab99f7 Mon Sep 17 00:00:00 2001 From: litongjava Date: Sun, 2 Feb 2025 15:42:08 -1000 Subject: [PATCH] update fallbackId --- ui/components/ChatWindow.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ui/components/ChatWindow.tsx b/ui/components/ChatWindow.tsx index 2e0505c..1be4ec5 100644 --- a/ui/components/ChatWindow.tsx +++ b/ui/components/ChatWindow.tsx @@ -429,25 +429,22 @@ const ChatWindow = ({id}: { id?: string }) => { setUserId(storedUserId); console.debug('Using existing user ID:', storedUserId); } else { - // 生成新的 MCID const newUserId = new Mcid().generate().toString(); // 转换为字符串 - // 存储到 localStorage localStorage.setItem('userId', newUserId); setUserId(newUserId); console.debug('Generated new user ID:', newUserId); } } catch (error) { console.error('Error initializing user ID:', error); - // 生成随机 ID 作为 fallback - const fallbackId = crypto.randomBytes(20).toString('hex'); + const fallbackId = "1234567890"; localStorage.setItem('userId', fallbackId); setUserId(fallbackId); } }; initializeUserId(); - }, []); // 空依赖数组确保只运行一次 + }, []); useEffect(() => { if (