Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

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
…108)

Co-authored-by: Yidadaa <yidadaa@qq.com>
  • Loading branch information
H0llyW00dzZ and Yidadaa authored Nov 15, 2023
1 parent 8f1333e commit 369b6d2
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 369b6d2

Please sign in to comment.