Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 部署在netlify使用gemini会莫名其妙地打断 #2566

Closed
xingpingcn opened this issue May 19, 2024 · 22 comments
Closed

[Bug] 部署在netlify使用gemini会莫名其妙地打断 #2566

xingpingcn opened this issue May 19, 2024 · 22 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@xingpingcn
Copy link

💻 Operating System

Windows

📦 Environment

Other

🌐 Browser

Chrome

🐛 Bug Description

部署在netlify使用gemini会莫名其妙地自行打断,但是使用官网提供的preview就没有这种情况

🚦 Expected Behavior

No response

📷 Recurrence Steps

复现条件不清楚,有些时候输出几个字就自己打断,有时候输出100字就自己打断。

📝 Additional Information

No response

@xingpingcn xingpingcn added the 🐛 Bug Something isn't working | 缺陷 label May 19, 2024
@lobehubbot
Copy link
Member

👀 @xingpingcn

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@sxjeru
Copy link
Contributor

sxjeru commented May 19, 2024

vercel 托管也有类似情况。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


A similar situation exists with vercel hosting.

Vercel too.

@xingpingcn
Copy link
Author

vercel 托管也有类似情况。

那现在是只能用自己的vps用docker托管比较靠谱?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Vercel hosting has a similar situation.

So now it is more reliable to only use your own vps and docker hosting?

@arvinxx
Copy link
Contributor

arvinxx commented May 19, 2024

部署在netlify使用gemini会莫名其妙地自行打断

在控制台有没有抛错?

官网提供的preview就没有这种情况

preview 用的是 vercel

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


When deployed on netlify and using gemini, it will interrupt itself inexplicably.

Are there any errors in the console?

This is not the case with the preview provided by the official website

preview uses vercel

@xingpingcn
Copy link
Author

在控制台有没有抛错?

chat.xingpingcn.top-1716164970665.log

且在network查看该post请求的状态码是200,日志显示的是”The user aborted a request“

另外使用的是edge,已经清除浏览器缓存。且初次打开的时候不断加载了这些js,非常卡

image

@arvinxx
Copy link
Contributor

arvinxx commented May 20, 2024

怎么样可以复现这个 user abort?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


How can I reproduce this user abort?

@xingpingcn
Copy link
Author

xingpingcn commented May 20, 2024

怎么样可以复现这个 user abort?

我让Gemini写一篇1k字以上的关于ai的文章,基本上输出的字体一多就容易触发,但是不是100%触发

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


How can I reproduce this user abort?

I asked Gemini to write an article about AI with more than 1k words

@xingpingcn
Copy link
Author

preview 用的是 vercel

因为是走的本地代理,而不是netlify服务器,现在临时的解决方法就是手动填写api和proxy了,但是这样子在环境变量填写的东西就失去意义了。解决的方法我想也很简单,只需要提供一个不用手动填写api和proxy就能走本地代理的按钮就行,api和proxy从netlify服务器环境变量中获取就可以

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


preview uses vercel

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.

@jimmyshjj
Copy link

jimmyshjj commented May 25, 2024

api和proxy从netlify服务器环境变量中获取就可以

API key不应发送到前端

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The api and proxy can be obtained from the netlify server environment variables
API key should not be sent to the frontend

@arvinxx
Copy link
Contributor

arvinxx commented May 25, 2024

preview 用的是 vercel

因为是走的本地代理,而不是netlify服务器,现在临时的解决方法就是手动填写api和proxy了,但是这样子在环境变量填写的东西就失去意义了。解决的方法我想也很简单,只需要提供一个不用手动填写api和proxy就能走本地代理的按钮就行,api和proxy从netlify服务器环境变量中获取就可以

如果前端调api key可以,但后端调用出现截断,那你可能要检查下是不是 netlify 的serverless 时间超时导致的了。比如像 vercel 的nodejs runtime 默认只支持 10s 的调用时长,超过10s就会自动销毁,表现出来就是生成一部分内容以后就掐断了。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


preview uses vercel

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 will be 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.

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.

@xingpingcn
Copy link
Author

preview 用的是 vercel

因为是走的本地代理,而不是netlify服务器,现在临时的解决方法就是手动填写api和proxy了,但是这样子在环境变量填写的东西就失去意义了。解决的方法我想也很简单,只需要提供一个不用手动填写api和proxy就能走本地代理的按钮就行,api和proxy从netlify服务器环境变量中获取就可以

如果前端调api key可以,但后端调用出现截断,那你可能要检查下是不是 netlify 的serverless 时间超时导致的了。比如像 vercel 的nodejs runtime 默认只支持 10s 的调用时长,超过10s就会自动销毁,表现出来就是生成一部分内容以后就掐断了。

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.

image

netlify可以提升到26s,但是要钱。不知道能不能按照它所说的改成异步来增加超时限制

@arvinxx
Copy link
Contributor

arvinxx commented May 25, 2024

netlify可以提升到26s,但是要钱

那你换成 vercel 部署就不会有这个问题了呗。

不知道能不能按照它所说的改成异步来增加超时限制

不可能,所有 ai 的 SSE 请求都是在一个 http 请求完成的,改成异步没有任何收益。

@arvinxx arvinxx closed this as completed May 25, 2024
@lobehubbot
Copy link
Member

@xingpingcn

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


netlify can be upgraded to 26s, but it costs money

Then if you switch to vercel deployment, you won't have this problem.

I wonder if it can be changed to asynchronous to increase the timeout limit as it says

Impossible, all SSE requests of ai are completed in an http request, and there is no gain in changing to asynchronous.

@lobehub lobehub locked and limited conversation to collaborators May 25, 2024
@arvinxx arvinxx converted this issue into discussion #2655 May 25, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
🐛 Bug Something isn't working | 缺陷
Projects
Status: Done
Development

No branches or pull requests

5 participants