mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-02 16:16:39 +08:00
初次优化认证-查询已存在用户时逻辑问题
This commit is contained in:
parent
20b35078f0
commit
8debb785fb
@ -159,12 +159,6 @@ export async function requestLog(
|
|||||||
}
|
}
|
||||||
const baseUrl = "http://localhost:3000";
|
const baseUrl = "http://localhost:3000";
|
||||||
const ip = getIP(req);
|
const ip = getIP(req);
|
||||||
// 对其进行 Base64 解码
|
|
||||||
// let h_userName = req.headers.get("x-request-name");
|
|
||||||
// if (h_userName) {
|
|
||||||
// const buffer = Buffer.from(h_userName, "base64");
|
|
||||||
// h_userName = decodeURIComponent(buffer.toString("utf-8"));
|
|
||||||
// }
|
|
||||||
let h_userName = await getSessionName();
|
let h_userName = await getSessionName();
|
||||||
console.log("[中文]", h_userName, baseUrl);
|
console.log("[中文]", h_userName, baseUrl);
|
||||||
const logData = {
|
const logData = {
|
||||||
@ -172,7 +166,7 @@ export async function requestLog(
|
|||||||
path: url_path,
|
path: url_path,
|
||||||
logEntry: JSON.stringify(jsonBody),
|
logEntry: JSON.stringify(jsonBody),
|
||||||
model: url_path.startsWith("mj/") ? "midjourney" : jsonBody?.model, // 后面尝试请求是添加到参数
|
model: url_path.startsWith("mj/") ? "midjourney" : jsonBody?.model, // 后面尝试请求是添加到参数
|
||||||
userName: h_userName,
|
name: h_userName,
|
||||||
};
|
};
|
||||||
|
|
||||||
await fetch(`${baseUrl}/api/logs/openai`, {
|
await fetch(`${baseUrl}/api/logs/openai`, {
|
||||||
|
@ -10,7 +10,7 @@ async function handle(
|
|||||||
try {
|
try {
|
||||||
const request_data = await req.json();
|
const request_data = await req.json();
|
||||||
if (request_data?.userName) {
|
if (request_data?.userName) {
|
||||||
await insertUser({ name: request_data?.userName });
|
await insertUser({ name: request_data?.name, email: request_data?.name });
|
||||||
}
|
}
|
||||||
// console.log("===========4", request_data);
|
// console.log("===========4", request_data);
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user