From d728cbb2678917d44529761df623b998a61e79af Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 5 May 2023 15:49:16 +0800 Subject: [PATCH] fix: v4 undefined problem --- .vscode/settings.json | 7 ++++++- app/api/utils/common.ts | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index edbfba9..e35fdc6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,5 +23,10 @@ }, "[jsonc]": { "editor.defaultFormatter": "vscode.json-language-features" - } + }, + "i18n-ally.localesPaths": [ + "i18n", + "i18n/lang", + "app/api/messages" + ] } \ No newline at end of file diff --git a/app/api/utils/common.ts b/app/api/utils/common.ts index e276dfa..87fadcc 100644 --- a/app/api/utils/common.ts +++ b/app/api/utils/common.ts @@ -1,12 +1,12 @@ import { type NextRequest } from 'next/server' import { APP_ID, API_KEY } from '@/config' import { ChatClient } from 'langgenius-client' -import uuid from 'uuid' +import { v4 } from 'uuid' const userPrefix = `user_${APP_ID}:`; export const getInfo = (request: NextRequest) => { - const sessionId = request.cookies.get('session_id')?.value || uuid.v4(); + const sessionId = request.cookies.get('session_id')?.value || v4(); const user = userPrefix + sessionId; return { sessionId,