fix(sse): batch tiny stream chunks before emitting#362
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89225c778e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
我刚想交 Pull Request 😂,动作真快,👏 |
正好 如果可以你把上面codex的review结果修一下吧 我没有电脑 我是手机codex远程修的 现在暂时没空了 你看清楚并入的这个 |
|
我尽力而为,但不一定成功,因为我本身不会go语言,上述都是由minimax2.5完成的。。。。 |
review了你的pr代码,实现逻辑还要再评估一下,你先暂时不用更新先,辛苦了,我处理一下后手,等后续有其他问题再看看 |
Motivation
Description
internal/sse/stream.go的StartParsedLinePump中增加了聚合逻辑,新增常量minFlushChars(默认 160)和maxFlushWait(默认 80ms)用于字符阈值和时间阈值的双重触发。select(支持ctx、定时器和行通道),以便实现定时刷新与及时取消。LineResult的字段判断),在遇到 stop / error / content_filter / 非内容行时先 flush 再发送控制事件,并在流结束时强制 flush。TestStartParsedLinePumpAccumulatesSmallChunks并调整现有多行测试的期望,使其与聚合语义一致;变更文件为internal/sse/stream.go和internal/sse/stream_edge_test.go。Testing
./scripts/lint.sh。./tests/scripts/check-refactor-line-gate.sh。./tests/scripts/run-unit-all.sh(所有测试通过)。npm run build --prefix webui。go test ./internal/sse -run TestStartParsedLinePump验证了相关流处理用例通过。Codex Task