UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

24 lines (16 loc) 547 B
import { auth } from '@clerk/nextjs/server'; import { enableClerk, enableNextAuth } from '@/const/auth'; import NextAuthEdge from '@/libs/next-auth/edge'; export const getUserAuth = async () => { if (enableClerk) { const clerkAuth = await auth(); const userId = clerkAuth.userId; return { clerkAuth: auth, userId }; } if (enableNextAuth) { const session = await NextAuthEdge.auth(); const userId = session?.user.id; return { nextAuth: session, userId }; } throw new Error('Auth method is not enabled'); };