@ynhcj/xiaoyi-channel 0.0.171-beta → 0.0.172-beta
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/src/file-upload.js
CHANGED
|
@@ -118,6 +118,8 @@ export function createXYReplyDispatcher(params) {
|
|
|
118
118
|
let accumulatedText = "";
|
|
119
119
|
let accumulatedReasoningHistory = "";
|
|
120
120
|
let lastReasoningText = "";
|
|
121
|
+
let accumulatedReplyHistory = "";
|
|
122
|
+
let lastReplyText = "";
|
|
121
123
|
const initialRunCrossTaskContext = getCurrentSessionContext()?.runCrossTaskContext;
|
|
122
124
|
const getRunCrossTaskContext = () => {
|
|
123
125
|
return getCurrentSessionContext()?.runCrossTaskContext ?? initialRunCrossTaskContext;
|
|
@@ -265,7 +267,7 @@ export function createXYReplyDispatcher(params) {
|
|
|
265
267
|
taskId: currentTaskId,
|
|
266
268
|
messageId: currentMessageId,
|
|
267
269
|
text: "",
|
|
268
|
-
append:
|
|
270
|
+
append: true,
|
|
269
271
|
final: true,
|
|
270
272
|
});
|
|
271
273
|
finalSent = true;
|
|
@@ -306,7 +308,7 @@ export function createXYReplyDispatcher(params) {
|
|
|
306
308
|
taskId: currentTaskId,
|
|
307
309
|
messageId: currentMessageId,
|
|
308
310
|
text: "任务执行异常,请重试~",
|
|
309
|
-
append:
|
|
311
|
+
append: true,
|
|
310
312
|
final: true,
|
|
311
313
|
errorCode: 99921111,
|
|
312
314
|
errorMessage: "任务执行异常,请重试",
|
|
@@ -441,9 +443,22 @@ export function createXYReplyDispatcher(params) {
|
|
|
441
443
|
}
|
|
442
444
|
const currentTaskId = getActiveTaskId();
|
|
443
445
|
const currentMessageId = getActiveMessageId();
|
|
444
|
-
|
|
446
|
+
let text = payload.text ?? "";
|
|
445
447
|
try {
|
|
446
448
|
if (text.length > 0) {
|
|
449
|
+
// 🔑 检测是否是新一轮回复:当前text比上一次短,或不以上次内容开头
|
|
450
|
+
const isNewRound = lastReplyText.length > 0 &&
|
|
451
|
+
(text.length < lastReplyText.length || !text.startsWith(lastReplyText));
|
|
452
|
+
if (isNewRound) {
|
|
453
|
+
// 将上一轮回复追加到历史
|
|
454
|
+
accumulatedReplyHistory += (accumulatedReplyHistory ? "\n\n" : "") + lastReplyText;
|
|
455
|
+
}
|
|
456
|
+
// 更新当前轮最后一次text
|
|
457
|
+
lastReplyText = text;
|
|
458
|
+
// 🔑 拼接历史 + 当前轮内容
|
|
459
|
+
const fullText = accumulatedReplyHistory
|
|
460
|
+
? accumulatedReplyHistory + "\n\n" + text
|
|
461
|
+
: text;
|
|
447
462
|
accumulatedText += text;
|
|
448
463
|
hasSentResponse = true;
|
|
449
464
|
// 🔑 流式文本通过 A2A text 通道发送(而非 reasoningText)
|
|
@@ -452,7 +467,7 @@ export function createXYReplyDispatcher(params) {
|
|
|
452
467
|
sessionId,
|
|
453
468
|
taskId: currentTaskId,
|
|
454
469
|
messageId: currentMessageId,
|
|
455
|
-
text,
|
|
470
|
+
text: fullText,
|
|
456
471
|
append: false,
|
|
457
472
|
final: false,
|
|
458
473
|
log: false,
|
|
@@ -71,7 +71,7 @@ export function createXiaoyiGuiTool(ctx) {
|
|
|
71
71
|
wsManager.off("gui-agent-response", handler);
|
|
72
72
|
logger.error("超时: XiaoYi GUI Agent 操作超时(5分钟)", { toolCallId });
|
|
73
73
|
reject(new Error("XiaoYi GUI Agent 操作超时(5分钟)"));
|
|
74
|
-
},
|
|
74
|
+
}, 300000); // 5 minutes timeout
|
|
75
75
|
// Listen for GUI agent response events
|
|
76
76
|
const handler = (event) => {
|
|
77
77
|
// Check if this is the InvokeJarvisGUIAgentResponse we're waiting for
|