From 0dfabd60ccc2581baf77e93856ffad51c07b7653 Mon Sep 17 00:00:00 2001 From: DirkSchlossmacher <62424946+DirkSchlossmacher@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:33:49 +0100 Subject: [PATCH] usageTokens --- app/auth.ts | 31 ------------------------------- app/client/platforms/openai.ts | 2 ++ 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/app/auth.ts b/app/auth.ts index eb8501e857e..f5504048522 100644 --- a/app/auth.ts +++ b/app/auth.ts @@ -32,37 +32,6 @@ declare module "next-auth" { // } } -/** - * Options for NextAuth.js used to configure adapters, providers, callbacks, etc. - * - * @see https://next-auth.js.org/configuration/options - */ -/* -export const authOptions: NextAuthOptions = { - callbacks: { - session: ({ session, token }) => ({ - ...session, - user: { - ...session.user, - id: token.sub, - }, - }), - }, - providers: [ - AzureADProvider({ - clientId: process.env.AZURE_AD_CLIENT_ID ?? "", - clientSecret: process.env.AZURE_AD_CLIENT_SECRET ?? "", - tenantId: process.env.AZURE_AD_TENANT_ID ?? "", - }), - ], - pages: { - signIn: "/login", - signOut: "/login", - error: "/login", - }, -}; -*/ - export const authOptions: NextAuthOptions = { callbacks: { async signIn({ user, account, profile }) { diff --git a/app/client/platforms/openai.ts b/app/client/platforms/openai.ts index 930d606900a..e96a74d986d 100644 --- a/app/client/platforms/openai.ts +++ b/app/client/platforms/openai.ts @@ -170,6 +170,8 @@ export class ChatGPTApi implements LLMApi { }, onmessage(msg) { if (msg.data === "[DONE]" || finished) { + const usageTokens = json.usage?; + console.log("usageTokens:", usageTokens); return finish(); } const text = msg.data;