@ynhcj/xiaoyi-channel 0.0.177-beta → 0.0.178-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/bot.js +0 -1
- package/dist/src/reply-dispatcher.js +3 -35
- package/package.json +1 -1
package/dist/src/bot.js
CHANGED
|
@@ -33,7 +33,6 @@ export async function handleXYMessage(params) {
|
|
|
33
33
|
try {
|
|
34
34
|
// Check for special messages BEFORE parsing (these have different param structures)
|
|
35
35
|
const messageMethod = message.method;
|
|
36
|
-
logger.log(`[BOT] Received A2A message: ${JSON.stringify(message)}`);
|
|
37
36
|
// Handle clearContext messages (sessionId at top level, no params)
|
|
38
37
|
if (messageMethod === "clearContext" || messageMethod === "clear_context") {
|
|
39
38
|
const sessionId = message.sessionId ?? message.params?.sessionId;
|
|
@@ -116,10 +116,6 @@ export function createXYReplyDispatcher(params) {
|
|
|
116
116
|
let hasSentResponse = false;
|
|
117
117
|
let finalSent = false;
|
|
118
118
|
let accumulatedText = "";
|
|
119
|
-
let accumulatedReasoningHistory = "";
|
|
120
|
-
let lastReasoningText = "";
|
|
121
|
-
let accumulatedReplyHistory = "";
|
|
122
|
-
let lastReplyText = "";
|
|
123
119
|
const initialRunCrossTaskContext = getCurrentSessionContext()?.runCrossTaskContext;
|
|
124
120
|
const getRunCrossTaskContext = () => {
|
|
125
121
|
return getCurrentSessionContext()?.runCrossTaskContext ?? initialRunCrossTaskContext;
|
|
@@ -408,26 +404,12 @@ export function createXYReplyDispatcher(params) {
|
|
|
408
404
|
}
|
|
409
405
|
try {
|
|
410
406
|
if (text.length > 0) {
|
|
411
|
-
// 🔑 检测是否是新一轮思考:当前text比上一次短,或不以上次内容开头
|
|
412
|
-
const isNewRound = lastReasoningText.length > 0 &&
|
|
413
|
-
text.length < lastReasoningText.length;
|
|
414
|
-
if (isNewRound) {
|
|
415
|
-
// 将上一轮思考追加到历史
|
|
416
|
-
accumulatedReasoningHistory += (accumulatedReasoningHistory ? "\n\n" : "") + lastReasoningText;
|
|
417
|
-
}
|
|
418
|
-
// 更新当前轮最后一次text
|
|
419
|
-
lastReasoningText = text;
|
|
420
|
-
// 🔑 拼接历史 + 当前轮内容
|
|
421
|
-
const fullText = accumulatedReasoningHistory
|
|
422
|
-
? accumulatedReasoningHistory + "\n\n" + text
|
|
423
|
-
: text;
|
|
424
|
-
// 🔑 将模型真实的thinking/reasoning内容通过reasoningText转发
|
|
425
407
|
await sendReasoningTextUpdate({
|
|
426
408
|
config,
|
|
427
409
|
sessionId,
|
|
428
410
|
taskId: currentTaskId,
|
|
429
411
|
messageId: currentMessageId,
|
|
430
|
-
text
|
|
412
|
+
text,
|
|
431
413
|
append: false,
|
|
432
414
|
});
|
|
433
415
|
}
|
|
@@ -443,31 +425,17 @@ export function createXYReplyDispatcher(params) {
|
|
|
443
425
|
}
|
|
444
426
|
const currentTaskId = getActiveTaskId();
|
|
445
427
|
const currentMessageId = getActiveMessageId();
|
|
446
|
-
|
|
428
|
+
const text = payload.text ?? "";
|
|
447
429
|
try {
|
|
448
430
|
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;
|
|
462
431
|
accumulatedText += text;
|
|
463
432
|
hasSentResponse = true;
|
|
464
|
-
// 🔑 流式文本通过 A2A text 通道发送(而非 reasoningText)
|
|
465
433
|
await sendA2AResponse({
|
|
466
434
|
config,
|
|
467
435
|
sessionId,
|
|
468
436
|
taskId: currentTaskId,
|
|
469
437
|
messageId: currentMessageId,
|
|
470
|
-
text
|
|
438
|
+
text,
|
|
471
439
|
append: false,
|
|
472
440
|
final: false,
|
|
473
441
|
log: false,
|