流式响应内容不能流式输出到前端 #6885
-
📦 部署环境Docker 📦 部署模式服务端模式(lobe-chat-database 镜像) 📌 软件版本v1.68.9 💻 系统环境Other Linux 🌐 浏览器Chrome 🐛 问题描述我本地开了一个openAI格式的API接口(在docker内),在lobechat里也设置了对应的接口。
然后配置好之后,可以直接使用这个api服务,但是这个服务的响应似乎不是一个字/Token一个字/Token的输出,从网络请求中可以看出,EventStream是一次性输出了多组信息,然后前端是一次性展示这些内容的。 但是我看api容器的日志,是实时输出的内容。并且我如果在我自己电脑运行这个api容器(不做其他的修改,完全一致),lobechat设置客户端请求的方式,来调用本机的接口(http://localhost:port/v1),是能正常输出Stream信息的。 这就很奇怪,我不确定是不是我docker的问题,但从现象上来看,不太可能是api容器的问题。 📷 复现步骤这边录制了一个视频,可以直接从视频中查看现象: lobechat.mp4🚦 期望结果流式输出内容 📝 补充信息暂无需要补充内容,如果有其他需要提供的内容,直接在这个issue内回复补充 |
Beta Was this translation helpful? Give feedback.
Replies: 25 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.
-
📦 Deployment environmentDocker 📦 Deployment modeServer-side mode (lobe-chat-database mirror) 📌 Software versionv1.68.9 💻 System environmentOther Linux 🌐 BrowserChrome 🐛 Question descriptionI opened an openAI format API interface (in docker) locally and set up the corresponding interface in lobechat.
Then after configuration, you can use this API service directly, but the response of this service does not seem to be the output of one word/Token, and it can be seen from the network request that EventStream outputs multiple sets of information at one time, and then the front-end displays these contents at one time. But I see that the logs of the API container are the contents output in real time. And if I run this API container on my own computer (no other modifications are made, it is completely consistent), lobechat sets the client request method to call the local interface (http://localhost:port/v1), which can output Stream information normally. This is very strange. I'm not sure if it's my docker problem, but from a phenomenon point of view, it's unlikely that it's a problem with the API container. 📷 Reproduction stepsA video was recorded here, and you can view the phenomenon directly from the video: PixPin_2025-03-06_13-43-26.mp4🚦 Expected resultsStreaming output content 📝 Supplementary informationThere is no need to add content yet. If there is any other content that needs to be provided, reply directly in this issue to add |
Beta Was this translation helpful? Give feedback.
-
same, #6686 |
Beta Was this translation helpful? Give feedback.
-
sorry,issue太多了,没搜到这条😥 |
Beta Was this translation helpful? Give feedback.
-
Sorry, there are too many issues, I haven't found this one 😥 |
Beta Was this translation helpful? Give feedback.
-
关于这条评论的猜想可能与#5824 有关。 |
Beta Was this translation helpful? Give feedback.
-
The guess about this comment may be related to #5824. |
Beta Was this translation helpful? Give feedback.
-
Addendum: This issue is a must-have, and it happens every time this API is called |
Beta Was this translation helpful? Give feedback.
-
经测试,只要在服务端请求,且相应结果是流式的,则就会出现这种卡顿。Google的API没有测出来 |
Beta Was this translation helpful? Give feedback.
-
After testing, this kind of stutter will occur as long as the request is requested on the server and the corresponding result is streaming. Google's API has not been tested |
Beta Was this translation helpful? Give feedback.
-
@jiongjiongJOJO @MultipledMe 测一下 #6831 这个PR 中的预览链接是否修复上述问题? |
Beta Was this translation helpful? Give feedback.
-
@jiongjiongJOJO @MultipledMe Test #6831 Is the preview link in this PR fixed? |
Beta Was this translation helpful? Give feedback.
-
我是docker部署的,我看下怎么docker build,试试能不能行 |
Beta Was this translation helpful? Give feedback.
-
@arvinxx 我尝试安装一下docker buildx,看看能不能编译成功吧 |
Beta Was this translation helpful? Give feedback.
-
@jiongjiongJOJO 我给你打个镜像把 |
Beta Was this translation helpful? Give feedback.
-
@jiongjiongJOJO I'll give you a mirror |
Beta Was this translation helpful? Give feedback.
-
OK,感谢! |
Beta Was this translation helpful? Give feedback.
-
OK, thanks! |
Beta Was this translation helpful? Give feedback.
-
[xxxx@localhost lobe-chat]#cat /etc/os-release |
Beta Was this translation helpful? Give feedback.
-
[xxxx@localhost lobe-chat]#cat /etc/os-release |
Beta Was this translation helpful? Give feedback.
-
@arvinxx 录像内容: PixPin_2025-03-09_20-15-15.mp4 |
Beta Was this translation helpful? Give feedback.
-
你本地部署的情况下是否有一个 nginx ?看下这个问题: #531 |
Beta Was this translation helpful? Give feedback.
-
感谢,确实是nginx配置问题,现在已经解决了!!
|
Beta Was this translation helpful? Give feedback.
-
另外,这样调整后也解决了另外一个问题:页面放在后台时(就是屏幕上看不到页面任何内容的情况下,有其他窗口在该页面之上时是正常的),流式内容不输出。 |
Beta Was this translation helpful? Give feedback.
感谢,确实是nginx配置问题,现在已经解决了!!