初次优化认证

This commit is contained in:
sijinhui
2024-03-30 22:41:41 +08:00
parent 3368e88d16
commit 20b35078f0
5 changed files with 37 additions and 45 deletions

View File

@@ -1,20 +1,8 @@
import { NextRequest, NextResponse } from "next/server";
import prisma from "@/lib/prisma";
import { insertUser } from "@/lib/auth";
// import { getTokenLength } from "@/app/utils/token";
// import { Tiktoken } from "tiktoken/lite"
// import cl100k_base from "tiktoken/encoders/cl100k_base.json"
// import "tiktoken";
// import { get_encoding } from "tiktoken";
import { addHours, subMinutes } from "date-fns";
import { getTokenLength } from "@/lib/utils";
// function getTokenLength(input: string): number {
// const encoding = get_encoding("cl100k_base");
// // console.log('tokens: ', input, encoding.countTokens())
// return encoding.encode(input).length;
// }
async function handle(
req: NextRequest,
{ params }: { params: { path: string[] } },