diff --git a/src/handle-request.ts b/src/handle-request.ts index 16aef4c..d5bb61f 100644 --- a/src/handle-request.ts +++ b/src/handle-request.ts @@ -28,6 +28,33 @@ export default async function handleRequest(request: NextRequest & { nextUrl?: U const { pathname, searchParams } = request.nextUrl ? request.nextUrl : new URL(request.url); + if(pathname === "/") { + let blank_html = ` + + + + + Google PaLM API proxy on Vercel Edge + + +

Google PaLM API proxy on Vercel Edge

+

Tips: This project uses a reverse proxy to solve problems such as location restrictions in Google APIs.

+

If you have any of the following requirements, you may need the support of this project.

+
    +
  1. When you see the error message "User location is not supported for the API use" when calling the Google PaLM API
  2. +
  3. You want to customize the Google PaLM API
  4. +
+

For technical discussions, please visit https://simonmy.com/posts/使用vercel反向代理google-palm-api.html

+ + + ` + return new Response(blank_html, { + headers: { + ...CORS_HEADERS, + "content-type": "text/html" + }, + }); + } // curl \ // -H 'Content-Type: application/json' \ // -d '{ "prompt": { "text": "Write a story about a magic backpack"} }' \