Skip to content

Commit e77eb4f

Browse files
authored
fix(assistant): use uuidv4 for chat ID generation (supabase#37462)
* fix(assistant-state): replace crypto.randomUUID with uuidv4 for chat ID generation * fix format
1 parent 2962a11 commit e77eb4f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

apps/studio/state/ai-assistant-state.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Message as MessageType } from 'ai/react'
22
import { DBSchema, IDBPDatabase, openDB } from 'idb'
33
import { debounce } from 'lodash'
44
import { createContext, PropsWithChildren, useContext, useEffect, useState } from 'react'
5+
import { v4 as uuidv4 } from 'uuid'
56
import { proxy, snapshot, subscribe, useSnapshot } from 'valtio'
67

78
import { LOCAL_STORAGE_KEYS } from 'common'
@@ -234,7 +235,7 @@ export const createAiAssistantState = (): AiAssistantState => {
234235
Pick<AiAssistantData, 'open' | 'initialInput' | 'sqlSnippets' | 'suggestions' | 'tables'>
235236
>
236237
) => {
237-
const chatId = crypto.randomUUID()
238+
const chatId = uuidv4()
238239
const newChat: ChatSession = {
239240
id: chatId,
240241
name: options?.name ?? 'Untitled',

0 commit comments

Comments
 (0)