Clarify rate limit code label

This commit is contained in:
Sam Becker 2025-02-16 19:19:09 -06:00
parent 96d17ddeb8
commit 73ec9b8f87

View File

@ -23,7 +23,7 @@ const ratelimit = HAS_VERCEL_KV
: undefined; : undefined;
// Allows 100 requests per hour // Allows 100 requests per hour
const checkRateLimitAndBailIfNecessary = async () => { const checkRateLimitAndThrow = async () => {
if (ratelimit) { if (ratelimit) {
let success = false; let success = false;
try { try {
@ -65,7 +65,7 @@ export const streamOpenAiImageQuery = async (
imageBase64: string, imageBase64: string,
query: string, query: string,
) => { ) => {
await checkRateLimitAndBailIfNecessary(); await checkRateLimitAndThrow();
const stream = createStreamableValue(''); const stream = createStreamableValue('');
@ -88,7 +88,7 @@ export const generateOpenAiImageQuery = async (
imageBase64: string, imageBase64: string,
query: string, query: string,
) => { ) => {
await checkRateLimitAndBailIfNecessary(); await checkRateLimitAndThrow();
const args = getImageTextArgs(imageBase64, query); const args = getImageTextArgs(imageBase64, query);
@ -99,7 +99,7 @@ export const generateOpenAiImageQuery = async (
}; };
export const testOpenAiConnection = async () => { export const testOpenAiConnection = async () => {
await checkRateLimitAndBailIfNecessary(); await checkRateLimitAndThrow();
if (openai) { if (openai) {
return generateText({ return generateText({