mirror of
https://github.com/langgenius/dify-conversation.git
synced 2026-07-01 18:25:52 -04:00
feat: add scoped app name
This commit is contained in:
+3
-1
@@ -1,2 +1,4 @@
|
||||
# you can find this in https://cloud.dify.ai/
|
||||
API_SECRET=YOUR_API_SECRET
|
||||
APP_ID=YOUR_APP_ID # This is your APP ID aka APP NAME will be used for generate user id under this scope
|
||||
API_SECRET=YOUR_API_SECRET # This is your API Secret
|
||||
|
||||
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import type { NextRequest } from 'next/server'
|
||||
import { v4 } from 'uuid'
|
||||
import dotenv from 'dotenv'
|
||||
dotenv.config()
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
const response = NextResponse.next()
|
||||
@@ -10,7 +12,7 @@ export function middleware(request: NextRequest) {
|
||||
}
|
||||
// Check and set the user cookie if it doesn't exist
|
||||
if (!request.cookies.has('user')) {
|
||||
response.cookies.set('user', v4())
|
||||
response.cookies.set('user', `${process.env.APP_ID}_${v4()}`)
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user