MCPcopy
hub / github.com/ATH-MaaS/ComfyUI-Copilot / generateUUID

Function generateUUID

ui/src/utils/uuid.ts:4–16  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2// Licensed under the MIT License.
3
4export function generateUUID(): string {
5 // 检查是否支持 crypto.randomUUID()
6 if (typeof crypto !== 'undefined' && crypto.randomUUID) {
7 return crypto.randomUUID();
8 }
9
10 // 降级方案:手动实现 UUID v4
11 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
12 const r = Math.random() * 16 | 0;
13 const v = c === 'x' ? r : (r & 0x3 | 0x8);
14 return v.toString(16);
15 });
16}

Callers 15

handleDebugClickFunction · 0.90
renderMessageFunction · 0.90
handleDebugClickFunction · 0.90
handleAcceptWorkflowFunction · 0.90
loadWorkflowFunction · 0.90
checkAndLoadSubgraphFunction · 0.90
doStreamStringFunction · 0.90
ParameterDebugInterfaceFunction · 0.90
resetAllStatesFunction · 0.90
saveHistoryItemFunction · 0.90
showGuideFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected