部署在 netlify 使用 gemini 会被打断? #2655
-
💻 Operating SystemWindows 📦 EnvironmentOther 🌐 BrowserChrome 🐛 Bug Description部署在netlify使用gemini会莫名其妙地自行打断,但是使用官网提供的preview就没有这种情况 🚦 Expected BehaviorNo response 📷 Recurrence Steps复现条件不清楚,有些时候输出几个字就自己打断,有时候输出100字就自己打断。 📝 Additional InformationNo response |
Beta Was this translation helpful? Give feedback.
Replies: 22 comments
-
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. |
Beta Was this translation helpful? Give feedback.
-
vercel 托管也有类似情况。 |
Beta Was this translation helpful? Give feedback.
-
A similar situation exists with vercel hosting. Vercel too. |
Beta Was this translation helpful? Give feedback.
-
那现在是只能用自己的vps用docker托管比较靠谱? |
Beta Was this translation helpful? Give feedback.
-
So now it is more reliable to only use your own vps and docker hosting? |
Beta Was this translation helpful? Give feedback.
-
在控制台有没有抛错?
preview 用的是 vercel |
Beta Was this translation helpful? Give feedback.
-
Are there any errors in the console?
preview uses vercel |
Beta Was this translation helpful? Give feedback.
-
chat.xingpingcn.top-1716164970665.log 且在network查看该post请求的状态码是200,日志显示的是”The user aborted a request“ 另外使用的是edge,已经清除浏览器缓存。且初次打开的时候不断加载了这些js,非常卡 |
Beta Was this translation helpful? Give feedback.
-
怎么样可以复现这个 user abort? |
Beta Was this translation helpful? Give feedback.
-
How can I reproduce this user abort? |
Beta Was this translation helpful? Give feedback.
-
我让Gemini写一篇1k字以上的关于ai的文章,基本上输出的字体一多就容易触发,但是不是100%触发 |
Beta Was this translation helpful? Give feedback.
-
I asked Gemini to write an article about AI with more than 1k words |
Beta Was this translation helpful? Give feedback.
-
因为是走的本地代理,而不是netlify服务器,现在临时的解决方法就是手动填写api和proxy了,但是这样子在环境变量填写的东西就失去意义了。解决的方法我想也很简单,只需要提供一个不用手动填写api和proxy就能走本地代理的按钮就行,api和proxy从netlify服务器环境变量中获取就可以 |
Beta Was this translation helpful? Give feedback.
-
Because we are using the local proxy instead of the netlify server, the temporary solution now is to manually fill in the api and proxy, but in this way, the things filled in the environment variables are meaningless. I think the solution is very simple. You just need to provide a button to use the local proxy without manually filling in the api and proxy. The api and proxy can be obtained from the netlify server environment variables. |
Beta Was this translation helpful? Give feedback.
-
API key不应发送到前端 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
如果前端调api key可以,但后端调用出现截断,那你可能要检查下是不是 netlify 的serverless 时间超时导致的了。比如像 vercel 的nodejs runtime 默认只支持 10s 的调用时长,超过10s就会自动销毁,表现出来就是生成一部分内容以后就掐断了。 |
Beta Was this translation helpful? Give feedback.
-
If the front-end API key can be adjusted, but the back-end call is truncated, you may want to check whether it is caused by netlify's serverless timeout. For example, the nodejs runtime of vercel only supports a call duration of 10 seconds by default. If it exceeds 10 seconds, it will be automatically destroyed. This is manifested in that it will be cut off after generating part of the content. |
Beta Was this translation helpful? Give feedback.
-
Normally, functions are synchronous with a maximum execution time of 10 seconds. But, adding -background to the end of the filename transforms any function into an asynchronous function that can run in the background with up to 15 minutes of runtime. netlify可以提升到26s,但是要钱。不知道能不能按照它所说的改成异步来增加超时限制 |
Beta Was this translation helpful? Give feedback.
-
那你换成 vercel 部署就不会有这个问题了呗。
不可能,所有 ai 的 SSE 请求都是在一个 http 请求完成的,改成异步没有任何收益。 |
Beta Was this translation helpful? Give feedback.
-
Then if you switch to vercel deployment, you won't have this problem.
Impossible, all SSE requests of ai are completed in an http request, and there is no gain in changing to asynchronous. |
Beta Was this translation helpful? Give feedback.
-
你在 |
Beta Was this translation helpful? Give feedback.
如果前端调api key可以,但后端调用出现截断,那你可能要检查下是不是 netlify 的serverless 时间超时导致的了。比如像 vercel 的nodejs runtime 默认只支持 10s 的调用时长,超过10s就会自动销毁,表现出来就是生成一部分内容以后就掐断了。