feat: lint code

This commit is contained in:
Joel
2023-06-10 14:04:40 +08:00
parent 2e46f795a4
commit cfd0c9532f
36 changed files with 226 additions and 210 deletions

View File

@ -1,16 +1,16 @@
import { type NextRequest } from 'next/server'
import { APP_ID, API_KEY, API_URL } from '@/config'
import { ChatClient } from 'dify-client'
import { v4 } from 'uuid'
import { API_KEY, API_URL, APP_ID } from '@/config'
const userPrefix = `user_${APP_ID}:`;
const userPrefix = `user_${APP_ID}:`
export const getInfo = (request: NextRequest) => {
const sessionId = request.cookies.get('session_id')?.value || v4();
const user = userPrefix + sessionId;
const sessionId = request.cookies.get('session_id')?.value || v4()
const user = userPrefix + sessionId
return {
sessionId,
user
user,
}
}
@ -18,4 +18,4 @@ export const setSession = (sessionId: string) => {
return { 'Set-Cookie': `session_id=${sessionId}` }
}
export const client = new ChatClient(API_KEY, API_URL ? API_URL : undefined)
export const client = new ChatClient(API_KEY, API_URL || undefined)