@ynhcj/xiaoyi-channel 0.0.171-beta → 0.0.173-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: "任务执行异常,请重试",
|
|
@@ -408,7 +410,7 @@ export function createXYReplyDispatcher(params) {
|
|
|
408
410
|
if (text.length > 0) {
|
|
409
411
|
// 🔑 检测是否是新一轮思考:当前text比上一次短,或不以上次内容开头
|
|
410
412
|
const isNewRound = lastReasoningText.length > 0 &&
|
|
411
|
-
|
|
413
|
+
text.length < lastReasoningText.length;
|
|
412
414
|
if (isNewRound) {
|
|
413
415
|
// 将上一轮思考追加到历史
|
|
414
416
|
accumulatedReasoningHistory += (accumulatedReasoningHistory ? "\n\n" : "") + lastReasoningText;
|
|
@@ -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,
|
|
@@ -21,7 +21,9 @@ c. htmlLocal 是本地HTML文件路径,会先上传获取预览链接再以卡
|
|
|
21
21
|
|
|
22
22
|
注意事项:
|
|
23
23
|
a. 操作超时时间为2分钟(120秒),请勿重复调用此工具,如果超时或失败,最多重试一次
|
|
24
|
-
b. 最后要把最终的html的公网地址作为工具执行结果返回回去,要以markdown
|
|
24
|
+
b. 最后要把最终的html的公网地址作为工具执行结果返回回去,要以markdown超链接的形式返回给用户,必须严格保留完整的url,包含url的鉴权鉴权信息,返回给用户的url必须是完整的
|
|
25
|
+
c. html类型的文件回传给用户优先用这个工具
|
|
26
|
+
d. 如果使用这个工具把html文件回传,则生成的html要尽可能适配用户的设备,如果用户使用的是手机,则尽可能生成竖屏的html的预览效果`,
|
|
25
27
|
parameters: {
|
|
26
28
|
type: "object",
|
|
27
29
|
properties: {
|
|
@@ -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
|