@ynhcj/xiaoyi 2.0.7 → 2.0.8
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/dist/channel.js +6 -30
- package/package.json +1 -1
package/dist/channel.js
CHANGED
|
@@ -245,15 +245,15 @@ exports.xiaoyiPlugin = {
|
|
|
245
245
|
SenderId: senderId,
|
|
246
246
|
OriginatingChannel: "xiaoyi",
|
|
247
247
|
};
|
|
248
|
-
// Use the correct API to dispatch the message
|
|
248
|
+
// Use the correct API to dispatch the message (non-streaming mode)
|
|
249
249
|
try {
|
|
250
250
|
await pluginRuntime.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
|
|
251
251
|
ctx: msgContext,
|
|
252
252
|
cfg: config,
|
|
253
253
|
dispatcherOptions: {
|
|
254
254
|
deliver: async (payload) => {
|
|
255
|
-
console.log("XiaoYi: Delivering final response:", payload);
|
|
256
|
-
// Send final response back through WebSocket
|
|
255
|
+
console.log("XiaoYi: Delivering final response:", payload.text?.substring(0, 100) + "...");
|
|
256
|
+
// Send final response back through WebSocket (non-streaming, complete message)
|
|
257
257
|
const taskId = runtime.getTaskIdForSession(message.sessionId) || `task_${Date.now()}`;
|
|
258
258
|
const response = {
|
|
259
259
|
sessionId: message.sessionId,
|
|
@@ -274,37 +274,13 @@ exports.xiaoyiPlugin = {
|
|
|
274
274
|
const conn = runtime.getConnection();
|
|
275
275
|
if (conn) {
|
|
276
276
|
await conn.sendResponse(response, taskId, message.sessionId);
|
|
277
|
-
console.log("XiaoYi: Final response sent successfully");
|
|
277
|
+
console.log("XiaoYi: Final response sent successfully (non-streaming mode)");
|
|
278
278
|
}
|
|
279
279
|
},
|
|
280
280
|
},
|
|
281
281
|
replyOptions: {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
console.log("XiaoYi: Streaming partial response:", payload.text?.substring(0, 50));
|
|
285
|
-
// Send partial response back through WebSocket
|
|
286
|
-
const taskId = runtime.getTaskIdForSession(message.sessionId) || `task_${Date.now()}`;
|
|
287
|
-
const partialResponse = {
|
|
288
|
-
sessionId: message.sessionId,
|
|
289
|
-
messageId: `partial_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
290
|
-
timestamp: Date.now(),
|
|
291
|
-
agentId: resolvedAccount.config.agentId,
|
|
292
|
-
sender: {
|
|
293
|
-
id: resolvedAccount.config.agentId,
|
|
294
|
-
name: "OpenClaw Agent",
|
|
295
|
-
type: "agent",
|
|
296
|
-
},
|
|
297
|
-
content: {
|
|
298
|
-
type: "text",
|
|
299
|
-
text: payload.text || "",
|
|
300
|
-
},
|
|
301
|
-
status: "processing",
|
|
302
|
-
};
|
|
303
|
-
const conn = runtime.getConnection();
|
|
304
|
-
if (conn) {
|
|
305
|
-
await conn.sendResponse(partialResponse, taskId, message.sessionId);
|
|
306
|
-
}
|
|
307
|
-
},
|
|
282
|
+
// Disable streaming by removing onPartialReply callback
|
|
283
|
+
// This ensures all responses are buffered and delivered only once at the end
|
|
308
284
|
},
|
|
309
285
|
});
|
|
310
286
|
}
|