no model tracking in redis

This commit is contained in:
DirkSchlossmacher 2023-11-23 15:19:55 +01:00
parent d0a8be1f26
commit bf334d93fe

View File

@ -112,34 +112,11 @@ export class ChatGPTApi implements LLMApi {
console.log("[Request] openai payload: ", requestPayload);
const modelIdentifier = modelConfig.model;
console.log("API Call: session or email is not available - model: ", modelIdentifier);
// const session = await getMyServerSession();
if (session?.user?.email) {
// Now you have the user's email from the session
const userEmail = session.user.email;
const dateKey = new Date().toISOString().slice(0, 7); // "YYYY-MM"
console.log("API Call: ", userEmail, modelIdentifier);
// Use the userEmail to increment the API call count
await incrementAPICallCount(userEmail, modelIdentifier, dateKey);
} else {
// Handle cases where the session or email is not available
console.log("API Call: session or email is not available - model: ", modelIdentifier);
}
/*
// export default async function handler(req: NextApiRequest, res: NextApiResponse) {
// Retrieve the session using getServerAuthSession
const session = await getServerSession();
const session = await getMyServerSession();
if (session?.user?.email) {
// Now you have the user's email from the session
@ -151,12 +128,11 @@ export class ChatGPTApi implements LLMApi {
// Use the userEmail to increment the API call count
await incrementAPICallCount(userEmail, modelIdentifier, dateKey);
// ... rest of your API route logic ...
} else {
// Handle cases where the session or email is not available
console.log("API Call: session or email is not available - model: ", modelIdentifier);
}
// }
*/
const shouldStream = !!options.config.stream;