增加日志提醒错误请求地址

This commit is contained in:
Vinlic
2024-04-05 01:05:00 +08:00
parent e5118c0ea4
commit 1283d7f5fc

View File

@@ -75,7 +75,9 @@ class Server {
logger.debug(`-> ${ctx.request.method} ${ctx.request.url} request is not supported - ${request.remoteIP || "unknown"}`);
// const failureBody = new FailureBody(new Exception(EX.SYSTEM_NOT_ROUTE_MATCHING, "Request is not supported"));
// const response = new Response(failureBody);
const failureBody = new FailureBody(new Error(`[请求有误]: 正确请求为 POST -> /v1/chat/completions ,当前请求为 ${ctx.request.method} -> ${ctx.request.url} 请纠正`));
const message = `[请求有误]: 正确请求为 POST -> /v1/chat/completions当前请求为 ${ctx.request.method} -> ${ctx.request.url} 请纠正`;
logger.warn(message);
const failureBody = new FailureBody(new Error(message));
const response = new Response(failureBody);
response.injectTo(ctx);
if(config.system.requestLog)