Comments (6)
I have tried it , but i didn't work , maybe the Astro 2 doesn't support this feature ?
from geminiprochat.
I'm afraid not. Next.js is by Vercel, so there's an official support.
We could have rewritten the request function using the following method:
import type { VercelRequest, VercelResponse } from '@vercel/node';
export const config = {
runtime: 'edge', // this is a pre-requisite
// execute this function on iad1 or hnd1, based on the connecting client location
regions: ['iad1', 'hnd1'],
};
export default function handler(
request: VercelRequest,
response: VercelResponse,
) {
return response.status(200).json({
text: `I am an Edge Function! (executed on ${process.env.VERCEL_REGION})`,
});
}
But because it is actually wrapped in @google/generative-ai, we cannot modify it.
from geminiprochat.
I'm afraid not. Next.js is by Vercel, so there's an official support.
We could have rewritten the request function using the following method:
import type { VercelRequest, VercelResponse } from '@vercel/node'; export const config = { runtime: 'edge', // this is a pre-requisite // execute this function on iad1 or hnd1, based on the connecting client location regions: ['iad1', 'hnd1'], }; export default function handler( request: VercelRequest, response: VercelResponse, ) { return response.status(200).json({ text: `I am an Edge Function! (executed on ${process.env.VERCEL_REGION})`, }); }But because it is actually wrapped in @google/generative-ai, we cannot modify it.
but this project is not base on Next.js framework
from geminiprochat.
Yes, so we may try the "Other frameworks" example, but we have to refrain from using @google/generative-ai and must rewrite the functionalities it provides on our own.
The docs require using VercelRequest, VercelResponse from @vercel/node, but @google/generative-ai (actually sends the request) won't follow it.
It is also possible that Google will eventually notice this issue and modify @google/generative-ai. Perhaps we should provide feedback to both Google and Vercel first?
I'm not familiar with modern front-end frameworks, so sorry for any confusion.
from geminiprochat.
this issue has a perfect solution now , see here
from geminiprochat.
Thank you for your efforts.
Just a kindly reminder, proxies are not allowed in Vercel Fair Use Policy, though Vercel seldom intervenes in these matters.
from geminiprochat.
Related Issues (20)
- 回复出现错误 HOT 2
- GoogleGenerativeAIError: [405 Method Not Allowed]
- API key not valid. Please pass a valid API key。 HOT 2
- 为什么我部署了之后就可以直接聊天了?我的apikey都还没添加呢。 HOT 1
- 电脑本地运行报错:[GoogleGenerativeAI Error]: Error fetching from [404 Not Found] HOT 3
- 最新的创建的本地docker+Vercel回报405 Method NOT Allowed HOT 1
- vercel部署添加自定义域名出现重定向无法打开,vercel分配的域名正常,请问是哪里的问题 HOT 6
- Netlify部署失败,显示网站不安全
- Send button not working when submitting request on my fork. HOT 2
- gemini大模型 – google gemini中文官网
- 使用vercel和VPS的docker均报错 HOT 5
- 用美国VPS部署项目,但网页无法访问,提示SyntaxError: Unexpected identifier HOT 1
- 啥时候 能把图片上传的部分,给补上?
- 还在维护吗?
- 用最新pnpm組件self-deploying發生錯誤 HOT 2
- [Docker] User location is not supported for the API use. HOT 3
- 部署在Render上,dockerfile会报错,我已经修复,
- Gemini Pro API 收费会对本项目有影响吗 HOT 1
- how to config the chosen model? HOT 1
- Stream Mode needed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geminiprochat.