Clarify rate limit code label
This commit is contained in:
parent
96d17ddeb8
commit
73ec9b8f87
@ -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({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user