mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-16 14:03:43 +08:00
进一步优化认证流程
This commit is contained in:
@@ -159,21 +159,22 @@ export async function requestLog(
|
||||
}
|
||||
const baseUrl = "http://localhost:3000";
|
||||
const ip = getIP(req);
|
||||
let h_userName = await getSessionName();
|
||||
console.log("[中文]", h_userName, baseUrl);
|
||||
|
||||
let { session, name } = await getSessionName();
|
||||
console.log("[中文]", name, session, baseUrl);
|
||||
const logData = {
|
||||
ip: ip,
|
||||
path: url_path,
|
||||
logEntry: JSON.stringify(jsonBody),
|
||||
model: url_path.startsWith("mj/") ? "midjourney" : jsonBody?.model, // 后面尝试请求是添加到参数
|
||||
userName: h_userName,
|
||||
userName: name,
|
||||
userID: session?.user?.id,
|
||||
};
|
||||
|
||||
await fetch(`${baseUrl}/api/logs/openai`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
// ...req.headers,
|
||||
},
|
||||
body: JSON.stringify(logData),
|
||||
});
|
||||
|
||||
@@ -9,12 +9,13 @@ async function handle(
|
||||
) {
|
||||
try {
|
||||
const request_data = await req.json();
|
||||
if (request_data?.userName) {
|
||||
await insertUser({
|
||||
name: request_data?.userName,
|
||||
email: request_data?.userName,
|
||||
});
|
||||
}
|
||||
console.log("log", request_data);
|
||||
// if (request_data?.userName) {
|
||||
// await insertUser({
|
||||
// name: request_data?.userName,
|
||||
// email: request_data?.userName,
|
||||
// });
|
||||
// }
|
||||
// console.log("===========4", request_data);
|
||||
try {
|
||||
if (request_data?.logEntry) {
|
||||
|
||||
Reference in New Issue
Block a user