From 8d8bd5c305313853dae5829ec92e598fa4df7957 Mon Sep 17 00:00:00 2001 From: zhaoyingbo Date: Thu, 27 Feb 2025 05:14:03 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E8=AF=B7=E6=B1=82=E5=A4=84=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B7=AF=E5=BE=84=E6=A3=80=E6=9F=A5=E4=BB=A5?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E6=8E=88=E6=9D=83=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/modelProxy/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/routes/modelProxy/index.ts b/routes/modelProxy/index.ts index 685391e..a67d434 100644 --- a/routes/modelProxy/index.ts +++ b/routes/modelProxy/index.ts @@ -6,11 +6,13 @@ import { Context } from "../../types" * @returns */ export const manageModelProxyReq = async (ctx: Context) => { - const { req, headers, logger } = ctx - const auth = headers.get("Authorization") - logger.info(`Start Model Proxy, Authorization: ${auth}`) - if (!auth || auth !== "Bearer sk-21a2ce1c2ee94bc2933798eac1bbcadc") { - return ctx.genResp.forbidden("Authorization required") + const { req, headers, logger, path } = ctx + if (!path.exact("/v1/models")) { + const auth = headers.get("Authorization") + logger.info(`Start Model Proxy, Authorization: ${auth}`) + if (!auth || auth !== "Bearer sk-21a2ce1c2ee94bc2933798eac1bbcadc") { + return ctx.genResp.forbidden("Authorization required") + } } const PROXY_URL = "http://ms-13871-nstruct-lmdeploy-2-0109140455.kscn-tj5-prod2-cloudml.xiaomi.srv"