This commit is contained in:
lloydzhou
2024-10-23 11:40:06 +08:00
parent 06f897f32f
commit 8455fefc8a
11 changed files with 447 additions and 1 deletions

View File

@@ -92,6 +92,9 @@ export function auth(req: NextRequest, modelProvider: ModelProvider) {
systemApiKey =
serverConfig.iflytekApiKey + ":" + serverConfig.iflytekApiSecret;
break;
case ModelProvider.XAI:
systemApiKey = serverConfig.xaiApiKey;
break;
case ModelProvider.GPT:
default:
if (req.nextUrl.pathname.includes("azure/deployments")) {
@@ -102,7 +105,7 @@ export function auth(req: NextRequest, modelProvider: ModelProvider) {
}
if (systemApiKey) {
console.log("[Auth] use system api key");
console.log("[Auth] use system api key", systemApiKey);
req.headers.set("Authorization", `Bearer ${systemApiKey}`);
} else {
console.log("[Auth] admin did not provide an api key");