Skip to content

Commit

Permalink
fix: ChatGPTNextWeb#3275 refuse on server side if hide user api key
Browse files Browse the repository at this point in the history
  • Loading branch information
Yidadaa committed Nov 15, 2023
1 parent d898ffc commit 9876a1a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/api/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export function auth(req: NextRequest) {
};
}

if (serverConfig.hideUserApiKey && !!apiKey) {
return {
error: true,
msg: "you are not allowed to access openai with your own api key",
};
}

// if user does not provide an api key, inject system api key
if (!apiKey) {
const serverApiKey = serverConfig.isAzure
Expand Down

0 comments on commit 9876a1a

Please sign in to comment.