Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
add index html
Browse files Browse the repository at this point in the history
  • Loading branch information
antergone committed Dec 26, 2023
1 parent d1d6564 commit e6e13f3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/handle-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Google PaLM API proxy on Vercel Edge</title>
</head>
<body>
<h1 id="google-palm-api-proxy-on-vercel-edge">Google PaLM API proxy on Vercel Edge</h1>
<p>Tips: This project uses a reverse proxy to solve problems such as location restrictions in Google APIs. </p>
<p>If you have any of the following requirements, you may need the support of this project.</p>
<ol>
<li>When you see the error message &quot;User location is not supported for the API use&quot; when calling the Google PaLM API</li>
<li>You want to customize the Google PaLM API</li>
</ol>
<p>For technical discussions, please visit <a href="https://simonmy.com/posts/使用vercel反向代理google-palm-api.html">https://simonmy.com/posts/使用vercel反向代理google-palm-api.html</a></p>
</body>
</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"} }' \
Expand Down

0 comments on commit e6e13f3

Please sign in to comment.