Comments (5)
About api/openai/[...path]:
If using edge, as long as the first byte arrives within 25 seconds, the streaming can continue indefinitely.
If using nodejs, regardless of when the first byte arrives, the total transmission time will be cut off if it exceeds the max-duration.
So the conclusion is to keep api/openai/[...path] as it is——set it as an edge function.
from chatgpt-next-web.
@maxduke Could you please reopen the issue? I think there should be a way to avoid the problem of Edge Functions timing out if they don't receive an API response within 25 seconds. I found the following two links on GitHub, and both approaches set up a keep alive heartbeat in the router:
As the docs explain, Edge Functions don't have a maximum streaming time once they started streaming. So a possible workaround for this issue could be to start streaming empty strings with a 2 second interval so that we keep the connection alive while the LLM API call loads.
https://github.com/orgs/vercel/discussions/3553#discussioncomment-7131497
Specifically, apart from sending a response within 25 seconds (which I currently do) you actually have to keep sending messages periodically (unclear at what frequency, but 15 seconds resolves the issue) to keep the stream alive.
But I'm a programming newbie and can't really handle the code😂😂😂 I hope some skilled expert can implement the heartbeat to solve the 25s timeout issue. Thanks a lot!
reopened. Thanks a lot for the information. Let’s see.
from chatgpt-next-web.
The timeout is currently set to 60 seconds in nextchat, you might want to check if something else is causing the 25-second prompt to run out, Or do you have any error screenshots? Let's examine the causes of early timeouts
from chatgpt-next-web.
The timeout is currently set to 60 seconds in nextchat, you might want to check if something else is causing the 25-second prompt to run out, Or do you have any error screenshots? Let's examine the causes of early timeouts
So I think maybe Edge runtime is involved.
According to https://vercel.com/docs/functions/configuring-functions/duration.
You can't configure a maximum duration for functions using the Edge runtime. They can run indefinitely provided they send an initial response within 25 seconds.
from chatgpt-next-web.
@maxduke
Could you please reopen the issue? I think there should be a way to avoid the problem of Edge Functions timing out if they don't receive an API response within 25 seconds. I found the following two links on GitHub, and both approaches set up a keep alive heartbeat in the router:
As the docs explain, Edge Functions don't have a maximum streaming time once they started streaming. So a possible workaround for this issue could be to start streaming empty strings with a 2 second interval so that we keep the connection alive while the LLM API call loads.
https://github.com/orgs/vercel/discussions/3553#discussioncomment-7131497
Specifically, apart from sending a response within 25 seconds (which I currently do) you actually have to keep sending messages periodically (unclear at what frequency, but 15 seconds resolves the issue) to keep the stream alive.
But I'm a programming newbie and can't really handle the code😂😂😂
I hope some skilled expert can implement the heartbeat to solve the 25s timeout issue. Thanks a lot!
from chatgpt-next-web.
Related Issues (20)
- [Bug] [Azure OpenAI] Typewriter animation effect is gone after switching from GPT-4 to GPT-4O
- [Bug] 当我询问用的Azure的哪个模型时,messages会预设我选择的模型,伪造成那个版本 HOT 3
- [Bug] MobileAgent使用GPT-4o HOT 1
- [Bug] 2.12.3 使用PROXY_URL部署后无法访问 HOT 3
- [Bug] Azure api 配置不生效 HOT 4
- 接口如果返回的是201而不是200会导致意外情况 HOT 3
- [Feature Request]: feat/voice-input分支版本与现在主分支不兼容 HOT 1
- [Feature Request]: Ability to change website title and brand
- [Feature Request]: I need to know what models I'm using and how much tokens consumed in each conversation.
- [Bug] nexthchat is stuck, how can I export my application data. HOT 1
- [Feature Request]: 基于模型服务商+模型名选择请求格式,而不是简单地依靠模型名 HOT 3
- [Bug] 在新拉取项目到本地电脑上,不能通过 bun run dev 在本地运行 HOT 4
- [Feature Request]: 能不能加入PDF文档分析功能 HOT 1
- [Feature Request]: 可以添加url参数来自动填写key吗? HOT 5
- [Feature Request]: 什么时候能够添加GPT4o的支持? HOT 7
- [Bug] GPT返回结果解析错误,多个一长串的json HOT 5
- [Feature Request]: 通过URL导入设置时,如果当前设置和要导入的设置相同则不弹窗提示 HOT 1
- 配置自定义ChatGPT模型时能否支持接口连接验证和获取可用模型列表 HOT 4
- [Bug] Webdav sync not working [SOLVED]
- [Bug] WebDAV Sync Failed HOT 13
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 chatgpt-next-web.