claw-subagent-service 0.0.76 → 0.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -369,17 +369,17 @@ class MessageHandler {
|
|
|
369
369
|
|
|
370
370
|
this.log?.info(`[MessageHandler] 流式消息完成,streamId=${streamId}, 总长度: ${fullText.length}`);
|
|
371
371
|
|
|
372
|
-
// 清理已存储的 messageUID,防止内存泄漏
|
|
373
|
-
this._streamMessageUIDs.delete(streamId);
|
|
374
|
-
|
|
375
372
|
// 发送持久化的普通文本消息作为历史记录(融云会保存 RC:TxtMsg)
|
|
376
373
|
if (buffer.trim()) {
|
|
377
374
|
try {
|
|
378
|
-
|
|
375
|
+
// 使用融云首流返回的 messageUID 作为 streamId,确保与前端匹配
|
|
376
|
+
const rongCloudMsgUID = this._streamMessageUIDs.get(streamId);
|
|
377
|
+
const historyStreamId = rongCloudMsgUID || streamId;
|
|
378
|
+
this.log?.info(`[MessageHandler] 发送历史记录文本消息: length=${buffer.length}, streamId=${historyStreamId}`);
|
|
379
379
|
// 使用 JSON 格式包含 streamId,前端可据此关联并更新流式消息内容
|
|
380
380
|
const historyContent = JSON.stringify({
|
|
381
381
|
__stream_history__: true,
|
|
382
|
-
streamId:
|
|
382
|
+
streamId: historyStreamId,
|
|
383
383
|
text: buffer,
|
|
384
384
|
sentTime: Date.now()
|
|
385
385
|
});
|
|
@@ -388,6 +388,9 @@ class MessageHandler {
|
|
|
388
388
|
this.log?.error(`[MessageHandler] 发送历史记录失败: ${err.message}`);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
+
|
|
392
|
+
// 清理已存储的 messageUID,防止内存泄漏
|
|
393
|
+
this._streamMessageUIDs.delete(streamId);
|
|
391
394
|
}
|
|
392
395
|
);
|
|
393
396
|
} catch (err) {
|