fixes azure
This commit is contained in:
parent
22d7f966c6
commit
514d1b7e31
|
@ -43,8 +43,8 @@ const azureOpenaiResponseHandler: ProxyResHandlerWithBody = async (
|
|||
const azureOpenAIProxy = createQueuedProxyMiddleware({
|
||||
target: ({ signedRequest }) => {
|
||||
if (!signedRequest) throw new Error("Must sign request before proxying");
|
||||
const { hostname, path } = signedRequest;
|
||||
return `https://${hostname}${path}`;
|
||||
const { hostname, protocol } = signedRequest;
|
||||
return `${protocol}//${hostname}`;
|
||||
},
|
||||
mutations: [addAzureKey, finalizeSignedRequest],
|
||||
blockingResponseHandler: azureOpenaiResponseHandler,
|
||||
|
|
|
@ -68,6 +68,14 @@ export class AzureOpenAIKeyChecker extends KeyCheckerBase<AzureOpenAIKey> {
|
|||
});
|
||||
case "429":
|
||||
const headers = error.response.headers;
|
||||
const retryAfter = Number(headers["retry-after"] || 0);
|
||||
if (retryAfter > 3600) {
|
||||
this.log.warn(
|
||||
{ key: key.hash, errorType, error: error.response.data, headers },
|
||||
"Key has an excessive rate limit and will be disabled."
|
||||
);
|
||||
return this.updateKey(key.hash, { isDisabled: true });
|
||||
}
|
||||
this.log.warn(
|
||||
{ key: key.hash, errorType, error: error.response.data, headers },
|
||||
"Key is rate limited. Rechecking key in 1 minute."
|
||||
|
|
Loading…
Reference in New Issue