mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-16 14:03:43 +08:00
用户页面增加使用token显示
This commit is contained in:
@@ -4,15 +4,16 @@ 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 "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;
|
||||
}
|
||||
// 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,
|
||||
|
||||
Reference in New Issue
Block a user