From 18608a1a367cb26af6b4a987fe697b8011ad1a77 Mon Sep 17 00:00:00 2001 From: zaidmukaddam Date: Wed, 18 Sep 2024 11:07:39 +0530 Subject: [PATCH] Update o1-mini rate limit to 10 requests/4hrs --- app/actions.ts | 10 +++++----- app/search/page.tsx | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/actions.ts b/app/actions.ts index 6c919d1..b8180cb 100644 --- a/app/actions.ts +++ b/app/actions.ts @@ -122,9 +122,9 @@ const redis = new Redis({ const ratelimit = new Ratelimit({ redis: redis, - limiter: Ratelimit.fixedWindow(10, '24 h'), + limiter: Ratelimit.fixedWindow(10, '4 h'), analytics: true, - prefix: 'mplx', + prefix: 'miniperplx', }); export interface Message { @@ -140,8 +140,8 @@ export async function continueConversation(history: Message[]) { const { success, limit, reset, remaining } = await ratelimit.limit(ip); if (!success) { - const resetDate = new Date(reset); - throw new Error(`Daily rate limit exceeded. Try again after ${resetDate.toLocaleTimeString()}.`); + const resetDate = new Date(reset * 1000); // Convert seconds to milliseconds + throw new Error(`4-hour rate limit exceeded. Try again after ${resetDate.toLocaleTimeString()}.`); } const { text } = await generateText({ @@ -158,7 +158,7 @@ export async function continueConversation(history: Message[]) { }, ], remaining, - reset, + reset: reset * 1000, // Convert seconds to milliseconds }; } diff --git a/app/search/page.tsx b/app/search/page.tsx index 17971a4..1627948 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -255,7 +255,7 @@ export default function Home() { -

Daily limit: {remainingRequests} requests remaining

+

4-hour limit: {remainingRequests} requests remaining

Resets at: {formatResetTime(resetTime)}