


























@@ -8,6 +8,7 @@ import {
88} from "openclaw/plugin-sdk/channel-message";
99import {
1010createChannelProgressDraftGate,
11+type ChannelProgressDraftLine,
1112formatChannelProgressDraftText,
1213isChannelProgressDraftWorkToolName,
1314resolveChannelPreviewStreamMode,
@@ -70,7 +71,7 @@ export function createTeamsReplyStreamController(params: {
70717172let streamReceivedTokens = false;
7273let informativeUpdateSent = false;
73-let progressLines: string[] = [];
74+let progressLines: Array<string | ChannelProgressDraftLine> = [];
7475let lastInformativeText = "";
7576let pendingFinalize: Promise<void> | undefined;
7677let liveState: LiveMessageState<ReplyPayload> = createLiveMessageState({
@@ -125,7 +126,7 @@ export function createTeamsReplyStreamController(params: {
125126};
126127127128const pushProgressLine = async (
128-line?: string,
129+line?: string | ChannelProgressDraftLine,
129130options?: { toolName?: string },
130131): Promise<void> => {
131132if (!stream || streamMode !== "progress") {
@@ -135,11 +136,13 @@ export function createTeamsReplyStreamController(params: {
135136return;
136137}
137138if (shouldStreamPreviewToolProgress) {
138-const normalized = line?.replace(/\s+/g, " ").trim();
139+const normalized = normalizeProgressLineIdentity(line);
139140if (normalized) {
140-const previous = progressLines.at(-1);
141+const previous = normalizeProgressLineIdentity(progressLines.at(-1));
141142if (previous !== normalized) {
142-progressLines = [...progressLines, normalized].slice(
143+const progressLine: string | ChannelProgressDraftLine =
144+typeof line === "object" && line !== undefined ? line : normalized;
145+progressLines = [...progressLines, progressLine].slice(
143146-resolveChannelProgressDraftMaxLines(params.msteamsConfig),
144147);
145148}
@@ -230,7 +233,10 @@ export function createTeamsReplyStreamController(params: {
230233stream.update(payload.text);
231234},
232235233-async pushProgressLine(line?: string, options?: { toolName?: string }): Promise<void> {
236+async pushProgressLine(
237+line?: string | ChannelProgressDraftLine,
238+options?: { toolName?: string },
239+): Promise<void> {
234240await pushProgressLine(line, options);
235241},
236242@@ -327,3 +333,10 @@ export function createTeamsReplyStreamController(params: {
327333},
328334};
329335}
336+337+function normalizeProgressLineIdentity(
338+line: string | ChannelProgressDraftLine | undefined,
339+): string {
340+const text = typeof line === "string" ? line : line?.text;
341+return text?.replace(/\s+/g, " ").trim() ?? "";
342+}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。