Commit d728cbb2 authored by Joel's avatar Joel

fix: v4 undefined problem

parent 7265f980
...@@ -23,5 +23,10 @@ ...@@ -23,5 +23,10 @@
}, },
"[jsonc]": { "[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features" "editor.defaultFormatter": "vscode.json-language-features"
} },
"i18n-ally.localesPaths": [
"i18n",
"i18n/lang",
"app/api/messages"
]
} }
\ No newline at end of file
import { type NextRequest } from 'next/server' import { type NextRequest } from 'next/server'
import { APP_ID, API_KEY } from '@/config' import { APP_ID, API_KEY } from '@/config'
import { ChatClient } from 'langgenius-client' import { ChatClient } from 'langgenius-client'
import uuid from 'uuid' import { v4 } from 'uuid'
const userPrefix = `user_${APP_ID}:`; const userPrefix = `user_${APP_ID}:`;
export const getInfo = (request: NextRequest) => { 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; const user = userPrefix + sessionId;
return { return {
sessionId, sessionId,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment