From 5f672eaa66f006dd903823c82c1758399391af72 Mon Sep 17 00:00:00 2001 From: litongjava Date: Sun, 2 Feb 2025 16:09:59 -1000 Subject: [PATCH] remove userId --- ui/components/ChatWindow.tsx | 2 +- ui/lib/mcid.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/components/ChatWindow.tsx b/ui/components/ChatWindow.tsx index 8e18b03..95a81e8 100644 --- a/ui/components/ChatWindow.tsx +++ b/ui/components/ChatWindow.tsx @@ -429,7 +429,7 @@ const ChatWindow = ({id}: { id?: string }) => { setUserId(storedUserId); console.debug('Using existing user ID:', storedUserId); } else { - const newUserId = new Mcid().generate().toString(); // 转换为字符串 + const newUserId = new Mcid().generate().toString(); localStorage.setItem('userId', newUserId); setUserId(newUserId); diff --git a/ui/lib/mcid.ts b/ui/lib/mcid.ts index 1a0d0d3..77d7f65 100644 --- a/ui/lib/mcid.ts +++ b/ui/lib/mcid.ts @@ -30,9 +30,7 @@ export class Mcid { this.lastTimestamp = now; return ( - (now * 0x1000) + // 时间戳左移 12 位 - (this.machineId * 16) + // 机器 ID 左移 4 位 - this.sequence // 序列号 + (now * 0x1000) + (this.machineId * 16) + this.sequence ); } }