forked from XiaoMo/ChatGPT-Next-Web
fix: #3275 refuse on server side if hide user api key
This commit is contained in:
parent
d898ffce23
commit
9876a1aeca
@ -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 user does not provide an api key, inject system api key
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
const serverApiKey = serverConfig.isAzure
|
const serverApiKey = serverConfig.isAzure
|
||||||
|
Loading…
Reference in New Issue
Block a user