Update o1-mini rate limit to 10 requests/4hrs
This commit is contained in:
parent
893d3af6cb
commit
18608a1a36
@ -122,9 +122,9 @@ const redis = new Redis({
|
|||||||
|
|
||||||
const ratelimit = new Ratelimit({
|
const ratelimit = new Ratelimit({
|
||||||
redis: redis,
|
redis: redis,
|
||||||
limiter: Ratelimit.fixedWindow(10, '24 h'),
|
limiter: Ratelimit.fixedWindow(10, '4 h'),
|
||||||
analytics: true,
|
analytics: true,
|
||||||
prefix: 'mplx',
|
prefix: 'miniperplx',
|
||||||
});
|
});
|
||||||
|
|
||||||
export interface Message {
|
export interface Message {
|
||||||
@ -140,8 +140,8 @@ export async function continueConversation(history: Message[]) {
|
|||||||
const { success, limit, reset, remaining } = await ratelimit.limit(ip);
|
const { success, limit, reset, remaining } = await ratelimit.limit(ip);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
const resetDate = new Date(reset);
|
const resetDate = new Date(reset * 1000); // Convert seconds to milliseconds
|
||||||
throw new Error(`Daily rate limit exceeded. Try again after ${resetDate.toLocaleTimeString()}.`);
|
throw new Error(`4-hour rate limit exceeded. Try again after ${resetDate.toLocaleTimeString()}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { text } = await generateText({
|
const { text } = await generateText({
|
||||||
@ -158,7 +158,7 @@ export async function continueConversation(history: Message[]) {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
remaining,
|
remaining,
|
||||||
reset,
|
reset: reset * 1000, // Convert seconds to milliseconds
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -255,7 +255,7 @@ export default function Home() {
|
|||||||
</div>
|
</div>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent>
|
<TooltipContent>
|
||||||
<p>Daily limit: {remainingRequests} requests remaining</p>
|
<p>4-hour limit: {remainingRequests} requests remaining</p>
|
||||||
<p>Resets at: {formatResetTime(resetTime)}</p>
|
<p>Resets at: {formatResetTime(resetTime)}</p>
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user