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 ); } }