Spaces:
Paused
Paused
Download src/utils/idGenerator.js from lin7zhi/antigravity2api2: direct link, hf CLI and curl.
- Browser
- Download file 806 Bytes
-
https://huggingface.co/spaces/lin7zhi/antigravity2api2/resolve/main/src/utils/idGenerator.js
- Command line
-
hf download hf://spaces/lin7zhi/antigravity2api2/src/utils/idGenerator.js
-
curl -L -o idGenerator.js https://huggingface.co/spaces/lin7zhi/antigravity2api2/resolve/main/src/utils/idGenerator.js
806 Bytes
| import { randomUUID } from 'crypto'; | |
| function generateRequestId() { | |
| return `agent-${randomUUID()}`; | |
| } | |
| function generateSessionId() { | |
| return String(-Math.floor(Math.random() * 9e18)); | |
| } | |
| function generateProjectId() { | |
| const adjectives = ['useful', 'bright', 'swift', 'calm', 'bold']; | |
| const nouns = ['fuze', 'wave', 'spark', 'flow', 'core']; | |
| const randomAdj = adjectives[Math.floor(Math.random() * adjectives.length)]; | |
| const randomNoun = nouns[Math.floor(Math.random() * nouns.length)]; | |
| const randomNum = Math.random().toString(36).substring(2, 7); | |
| return `${randomAdj}-${randomNoun}-${randomNum}`; | |
| } | |
| function generateToolCallId() { | |
| return `call_${randomUUID().replace(/-/g, '')}`; | |
| } | |
| export { | |
| generateProjectId, | |
| generateSessionId, | |
| generateRequestId, | |
| generateToolCallId | |
| } |