feat: add webchat Word-by-word output

fix:webchat on message stream bug
This commit is contained in:
Dong_master
2025-08-02 01:42:22 +08:00
committed by Junyan Qin
parent c6deed4e6e
commit 68906c43ff
2 changed files with 84 additions and 32 deletions

View File

@@ -430,12 +430,12 @@ class HttpClient {
// 处理完整的JSON对象
const lines = buffer.split('\n\n');
buffer = '';
buffer = lines.pop() || '';
for (const line of lines) {
if (line.startsWith('data:')) {
try {
const data = JSON.parse(line.slice(6));
const data = JSON.parse(line.slice(5));
if (data.type === 'end') {
// 流传输结束