mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-08 19:16:37 +08:00
const session = await getServerSession();
This commit is contained in:
parent
62955f1347
commit
51e5785ce4
@ -20,12 +20,35 @@ import { makeAzurePath } from "@/app/azure";
|
||||
|
||||
//# for AdEx custom usage tracking (calls per model per user per datekey)
|
||||
// import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { getServerAuthSession } from '../../auth'; // Adjust the import path as necessary
|
||||
import { getServerSession } from "next-auth";
|
||||
import { incrementAPICallCount } from '../../utils/cloud/redisRestClient';
|
||||
// app\utils\cloud\redisRestClient.ts
|
||||
// app\client\platforms\openai.ts
|
||||
// app\auth.ts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default async function handler(req, res) {
|
||||
const session = await getServerSession(req, res, authOptions)
|
||||
|
||||
if (!session) {
|
||||
res.status(401).json({ message: "You must be logged in." });
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("session within openai.ts:", session);
|
||||
|
||||
return res.json({
|
||||
message: 'Success',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export interface OpenAIListModelResponse {
|
||||
object: string;
|
||||
data: Array<{
|
||||
@ -106,7 +129,7 @@ export class ChatGPTApi implements LLMApi {
|
||||
|
||||
// export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
// Retrieve the session using getServerAuthSession
|
||||
const session = await getServerAuthSession()(req);
|
||||
const session = await getServerSession();
|
||||
|
||||
if (session?.user?.email) {
|
||||
// Now you have the user's email from the session
|
||||
|
Loading…
Reference in New Issue
Block a user