From b29494d06359426ce9372f5a4af343266b3d4aae Mon Sep 17 00:00:00 2001 From: hexiaonan-800 Date: Fri, 11 Sep 2026 18:02:30 +0800 Subject: [PATCH] fix: Replace randomUUID with uuidv4 --- .../conversation/common/use-chat-store/chat/index.ts | 3 ++- .../conversation/common/use-chat-store/debug/index.ts | 3 ++- ui/src/views/login/modes/AccountLogin.vue | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/src/components/conversation/common/use-chat-store/chat/index.ts b/ui/src/components/conversation/common/use-chat-store/chat/index.ts index dee38731556..a65d4e52d1e 100644 --- a/ui/src/components/conversation/common/use-chat-store/chat/index.ts +++ b/ui/src/components/conversation/common/use-chat-store/chat/index.ts @@ -6,6 +6,7 @@ import { useMessagePagination } from '../shared/use-message-pagination' import { useConversationCrud } from '../shared/use-conversation-crud' import { aggregators } from '../../../index' import type { ChatMessage } from '../../types' +import { v4 as uuidv4 } from 'uuid' // ── 共享状态(单例) ───────────────────────────────────── const appInfo = ref<{ name: string; icon: string } | null>(null) @@ -86,7 +87,7 @@ export function useChatStore() { // 不请求后端 open,不往左侧列表 push(直到首次发消息才入列表,见 chat-panel send)。 const getChatId = (): string => { if (currentChatId.value) return currentChatId.value - currentChatId.value = crypto.randomUUID() + currentChatId.value = uuidv4() return currentChatId.value } diff --git a/ui/src/components/conversation/common/use-chat-store/debug/index.ts b/ui/src/components/conversation/common/use-chat-store/debug/index.ts index 6ffea95fdd8..8c0c40bee02 100644 --- a/ui/src/components/conversation/common/use-chat-store/debug/index.ts +++ b/ui/src/components/conversation/common/use-chat-store/debug/index.ts @@ -6,6 +6,7 @@ import { useMessagePagination } from '../shared/use-message-pagination' import { useConversationCrud } from '../shared/use-conversation-crud' import { aggregators, Scroll } from '../../../index' import type { ChatMessage } from '../../types' +import { v4 as uuidv4 } from 'uuid' // ── 共享状态(单例) ───────────────────────────────────── const appInfo = ref<{ name: string; icon: string } | null>(null) @@ -95,7 +96,7 @@ export function useDebugStore() { // 不请求后端 open,不往左侧列表 push(直到首次发消息才入列表,见 chat-panel send)。 const getChatId = (): string => { if (currentChatId.value) return currentChatId.value - currentChatId.value = crypto.randomUUID() + currentChatId.value = uuidv4() return currentChatId.value } diff --git a/ui/src/views/login/modes/AccountLogin.vue b/ui/src/views/login/modes/AccountLogin.vue index 716e6a7f9a0..f137e625317 100644 --- a/ui/src/views/login/modes/AccountLogin.vue +++ b/ui/src/views/login/modes/AccountLogin.vue @@ -10,6 +10,7 @@ import { useStore } from '@/stores' import { LOGIN_METHOD } from '@/api/enums' import type { LoginConfig, LoginMethod } from '@/api/types' import { MsgConfirm } from '@/utils/message' +import { v4 as uuidv4 } from 'uuid' interface AccountLoginForm { captcha: string @@ -142,7 +143,7 @@ const getExternalLoginUrl = (authType: LoginMethod): Promise => { } if (authType === LOGIN_METHOD.OAUTH2) { if (!config.authEndpoint || !config.clientId) return '' - let url = `${config.authEndpoint}?client_id=${config.clientId}&response_type=code&redirect_uri=${redirectUrl}&state=${crypto.randomUUID()}` + let url = `${config.authEndpoint}?client_id=${config.clientId}&response_type=code&redirect_uri=${redirectUrl}&state=${uuidv4()}` if (config.scope) url += `&scope=${config.scope}` return url }