From 0e2b99e780fb9dad0c99141673a7a893f2aa8896 Mon Sep 17 00:00:00 2001 From: babaohuang Date: Fri, 15 Dec 2023 09:41:51 +0800 Subject: [PATCH] exclude region --- src/pages/api/generate.ts | 6 ++++++ vercel.json | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pages/api/generate.ts b/src/pages/api/generate.ts index 52dd477d..059a103f 100644 --- a/src/pages/api/generate.ts +++ b/src/pages/api/generate.ts @@ -2,6 +2,12 @@ import { startChatAndSendMessageStream } from '@/utils/openAI' import { verifySignature } from '@/utils/auth' import type { APIRoute } from 'astro' +export const config = { + runtime: 'edge', // this is a pre-requisite + // execute this function on iad1 or hnd1, based on the connecting client location + regions: ['arn1', 'bom1', 'cdg1', 'cle1', 'cpt1', 'dub1', 'fra1', 'gru1', 'hnd1', 'iad1', 'icn1', 'kix1', 'lhr1', 'pdx1', 'sfo1', 'sin1', 'syd1'], +} + const sitePassword = import.meta.env.SITE_PASSWORD || '' const passList = sitePassword.split(',') || [] diff --git a/vercel.json b/vercel.json index 15e09096..f70eaa45 100644 --- a/vercel.json +++ b/vercel.json @@ -1,4 +1,3 @@ { - "buildCommand": "OUTPUT=vercel astro build", - "regions": ["hnd1"] + "buildCommand": "OUTPUT=vercel astro build" } \ No newline at end of file