We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 25b5f89 commit a0597deCopy full SHA for a0597de
app/models/ChatManager.ts
@@ -9,12 +9,12 @@ export class ChatManager {
9
this.listElement = listElement
10
this.agentBaseURL = agentBaseURL
11
12
- this.userId = `user-${ChatManager.generateUUID()}`
13
- this.roomId = `default-room-${ChatManager.generateUUID()}`
+ this.userId = ChatManager.generateID('xxxxxxx')
+ this.roomId = `room-${ChatManager.generateID('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx')}`
14
}
15
16
- static generateUUID(): string {
17
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
+ static generateID(template: string): string {
+ return template.replace(/[xy]/g, (c) => {
18
const r = Math.random() * 16 | 0
19
const v = c === 'x' ? r : (r & 0x3 | 0x8)
20
return v.toString(16)
0 commit comments