claw-subagent-service 0.0.68 → 0.0.69
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
|
@@ -13,6 +13,7 @@ class MessageHandler {
|
|
|
13
13
|
this.openclawClient = new OpenClawClient(log);
|
|
14
14
|
this.nodeId = config.accountId || '';
|
|
15
15
|
this.handleNormalMessage = handleNormalMessage;
|
|
16
|
+
this._streamQueue = Promise.resolve();
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
/**
|
|
@@ -293,27 +294,33 @@ class MessageHandler {
|
|
|
293
294
|
this.log?.warn('[MessageHandler] _sendStreamChunk skipped: isStreamingEnabled=false');
|
|
294
295
|
return;
|
|
295
296
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
297
|
+
|
|
298
|
+
// 使用队列确保流式消息片段串行发送,避免并发导致后端处理错乱
|
|
299
|
+
this._streamQueue = this._streamQueue.then(async () => {
|
|
300
|
+
try {
|
|
301
|
+
const resp = await axios.post(
|
|
302
|
+
`${this.config.apiBaseUrl}/im/api/proxy/stream/publish`,
|
|
303
|
+
{
|
|
304
|
+
fromUserId,
|
|
305
|
+
targetId,
|
|
306
|
+
content,
|
|
307
|
+
streamId,
|
|
308
|
+
isFirstChunk,
|
|
309
|
+
isLastChunk,
|
|
310
|
+
conversationType,
|
|
311
|
+
seq
|
|
312
|
+
},
|
|
313
|
+
{ timeout: 10000 }
|
|
314
|
+
);
|
|
315
|
+
this.log?.info(`[MessageHandler] _sendStreamChunk 成功: status=${resp.status}, seq=${seq}`);
|
|
316
|
+
} catch (err) {
|
|
317
|
+
const url = `${this.config.apiBaseUrl}/im/api/proxy/stream/publish`;
|
|
318
|
+
const status = err.response?.status;
|
|
319
|
+
this.log?.warn(`[MessageHandler] 发送流式消息失败: ${err.message}, url=${url}, status=${status || 'N/A'}, seq=${seq}`);
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
await this._streamQueue;
|
|
317
324
|
}
|
|
318
325
|
|
|
319
326
|
parseCommand(raw, senderId) {
|