修复小细节

This commit is contained in:
sijinhui 2023-12-28 13:22:09 +08:00
parent 1e7d20580d
commit b0e56e17c7
4 changed files with 23 additions and 15 deletions

View File

@ -52,6 +52,7 @@ RUN rm -f .env
EXPOSE 3000 EXPOSE 3000
ENV KEEP_ALIVE_TIMEOUT=30 ENV KEEP_ALIVE_TIMEOUT=30
ENV HOSTNAME=""
CMD if [ -n "$PROXY_URL" ]; then \ CMD if [ -n "$PROXY_URL" ]; then \
export HOSTNAME="127.0.0.1"; \ export HOSTNAME="127.0.0.1"; \

View File

@ -13,13 +13,17 @@ async function handle(
await insertUser({ name: request_data?.userName }); await insertUser({ name: request_data?.userName });
} }
// console.log("===========4", request_data); // console.log("===========4", request_data);
if (request_data?.logEntry) { try {
const regex = /\[(.*)]/g; if (request_data?.logEntry) {
const matchResponse = request_data.logEntry.match(regex); const regex = /\[(.*)]/g;
if (matchResponse.length > 0) { const matchResponse = request_data.logEntry.match(regex);
request_data.logToken = getTokenLength(matchResponse[0]); if (matchResponse.length > 0) {
request_data.logToken = getTokenLength(matchResponse[0]);
}
} }
// console.log('=======', request_data.logEntry, '=====', matchResponse); } catch (e) {
console.log("[LOG]", "logToken", e);
request_data.logToken = 0;
} }
await prisma.logEntry.create({ await prisma.logEntry.create({

View File

@ -77,7 +77,8 @@ async function handle(
try { try {
const protocol = req.headers.get("x-forwarded-proto") || "http"; const protocol = req.headers.get("x-forwarded-proto") || "http";
const baseUrl = process.env.NEXTAUTH_URL ?? "http://localhost:3000"; //const baseUrl = process.env.NEXTAUTH_URL ?? "http://localhost:3000";
const baseUrl = "http://localhost:3000";
const ip = getIP(req); const ip = getIP(req);
// 对其进行 Base64 解码 // 对其进行 Base64 解码
let h_userName = req.headers.get("x-request-name"); let h_userName = req.headers.get("x-request-name");

View File

@ -65,14 +65,16 @@ export default async function UsageByModel() {
0, 0,
0, 0,
); );
const endOfTheDayInTimeZone = new Date( // const endOfTheDayInTimeZone = new Date(
today.getFullYear(), // today.getFullYear(),
today.getMonth(), // today.getMonth(),
today.getDate(), // today.getDate(),
23, // 23,
59, // 59,
59, // 59,
); // 当天的结束时间 // ); // 当天的结束时间
const endOfTheDayInTimeZone = addHours(startOfTheDayInTimeZone, +24); // 当天的结束时间
// const startDate = addHours(startOfTheDayInTimeZone, -8); // const startDate = addHours(startOfTheDayInTimeZone, -8);
// const endDate = addHours(endOfTheDayInTimeZone, -8); // const endDate = addHours(endOfTheDayInTimeZone, -8);
console.log("===", today, startOfTheDayInTimeZone, endOfTheDayInTimeZone); console.log("===", today, startOfTheDayInTimeZone, endOfTheDayInTimeZone);