@ynhcj/xiaoyi-channel 0.0.160-next → 0.0.161-next

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.
@@ -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;
@@ -406,28 +402,15 @@ export function createXYReplyDispatcher(params) {
406
402
  if (lines[0]?.trim() === "Reasoning:") {
407
403
  text = lines.slice(1).join("\n").trim();
408
404
  }
405
+ scopedLog().log(`[REASONING-STREAM] ${text.substring(0, 100)}`);
409
406
  try {
410
407
  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
408
  await sendReasoningTextUpdate({
426
409
  config,
427
410
  sessionId,
428
411
  taskId: currentTaskId,
429
412
  messageId: currentMessageId,
430
- text: fullText,
413
+ text,
431
414
  append: false,
432
415
  });
433
416
  }
@@ -443,31 +426,17 @@ export function createXYReplyDispatcher(params) {
443
426
  }
444
427
  const currentTaskId = getActiveTaskId();
445
428
  const currentMessageId = getActiveMessageId();
446
- let text = payload.text ?? "";
429
+ const text = payload.text ?? "";
447
430
  try {
448
431
  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
432
  accumulatedText += text;
463
433
  hasSentResponse = true;
464
- // 🔑 流式文本通过 A2A text 通道发送(而非 reasoningText)
465
434
  await sendA2AResponse({
466
435
  config,
467
436
  sessionId,
468
437
  taskId: currentTaskId,
469
438
  messageId: currentMessageId,
470
- text: fullText,
439
+ text,
471
440
  append: false,
472
441
  final: false,
473
442
  log: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.160-next",
3
+ "version": "0.0.161-next",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",