Recognize Claude weekly limits #16
+1
-1
@@ -5,7 +5,7 @@ export type BotProfile = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function isUsageExhausted(error: unknown): boolean {
|
function isUsageExhausted(error: unknown): boolean {
|
||||||
return /(?:usage|rate) limit|hit your limit|insufficient_quota|exceeded your current quota|too many requests|(?:api error|http error|http|status(?: code)?)[ :]+4(?:02|29)\b/i
|
return /(?:usage|rate) limit|hit your (?:weekly )?limit|insufficient_quota|exceeded your current quota|too many requests|(?:api error|http error|http|status(?: code)?)[ :]+4(?:02|29)\b/i
|
||||||
.test(String(error));
|
.test(String(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Deno.test("recognizes Claude's weekly limit message", async () => {
|
|||||||
],
|
],
|
||||||
(profile) => {
|
(profile) => {
|
||||||
if (profile.type === "claude") {
|
if (profile.type === "claude") {
|
||||||
throw new Error("You've hit your limit · resets Monday");
|
throw new Error("You've hit your weekly limit · resets 12am (UTC)");
|
||||||
}
|
}
|
||||||
return Promise.resolve("fallback");
|
return Promise.resolve("fallback");
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user