mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-08 19:16:37 +08:00
usageTokens
This commit is contained in:
parent
83ed6bfc0b
commit
0dfabd60cc
31
app/auth.ts
31
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 = {
|
export const authOptions: NextAuthOptions = {
|
||||||
callbacks: {
|
callbacks: {
|
||||||
async signIn({ user, account, profile }) {
|
async signIn({ user, account, profile }) {
|
||||||
|
@ -170,6 +170,8 @@ export class ChatGPTApi implements LLMApi {
|
|||||||
},
|
},
|
||||||
onmessage(msg) {
|
onmessage(msg) {
|
||||||
if (msg.data === "[DONE]" || finished) {
|
if (msg.data === "[DONE]" || finished) {
|
||||||
|
const usageTokens = json.usage?;
|
||||||
|
console.log("usageTokens:", usageTokens);
|
||||||
return finish();
|
return finish();
|
||||||
}
|
}
|
||||||
const text = msg.data;
|
const text = msg.data;
|
||||||
|
Loading…
Reference in New Issue
Block a user