






















@@ -381,10 +381,10 @@ describe("dispatchTelegramMessage draft streaming", () => {
381381return expectRecordFields(mockCallArg(createTelegramDraftStream), expected);
382382}
383383384-function telegramProgressPreview(text: string, html: string) {
384+function telegramProgressPreview(_plainText: string, html: string) {
385385return {
386- text,
387-richMessage: { html: html.replaceAll("\n", "<br>"), skip_entity_detection: true },
386+text: html.replaceAll("\n", "<br>"),
387+parseMode: "HTML" as const,
388388};
389389}
390390@@ -1892,7 +1892,15 @@ describe("dispatchTelegramMessage draft streaming", () => {
18921892content: fullAnswer,
18931893messageId: 2001,
18941894});
1895-expect(appendSessionTranscriptMessage).not.toHaveBeenCalled();
1895+const transcriptCall = expectRecordFields(mockCallArg(appendSessionTranscriptMessage), {
1896+transcriptPath: "/tmp/session.jsonl",
1897+});
1898+expectRecordFields(transcriptCall.message, {
1899+role: "assistant",
1900+provider: "openclaw",
1901+model: "delivery-mirror",
1902+content: [{ type: "text", text: fullAnswer }],
1903+});
18961904});
1897190518981906it("emits the redacted appended message in transcript updates", async () => {
@@ -2510,7 +2518,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
25102518expect(answerDraftStream.update).toHaveBeenNthCalledWith(1, "Site A shows X.");
25112519expect(answerDraftStream.update).toHaveBeenNthCalledWith(2, "Site A shows X.");
25122520expect(answerDraftStream.updatePreview).toHaveBeenCalledWith(
2513-expect.objectContaining({ text: expect.stringMatching(/🛠️ Exec$/) }),
2521+expect.objectContaining({ text: expect.stringMatching(/🛠️ Exec<\/b>$/) }),
25142522);
25152523expect(answerDraftStream.update).toHaveBeenNthCalledWith(3, "Final answer");
25162524expect(answerDraftStream.clear).toHaveBeenCalledTimes(1);
@@ -2537,7 +2545,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
2537254525382546expect(answerDraftStream.update).toHaveBeenNthCalledWith(1, "Site A shows X.");
25392547expect(answerDraftStream.updatePreview).toHaveBeenCalledWith(
2540-expect.objectContaining({ text: expect.stringMatching(/🛠️ Exec$/) }),
2548+expect.objectContaining({ text: expect.stringMatching(/🛠️ Exec<\/b>$/) }),
25412549);
25422550expect(answerDraftStream.update).toHaveBeenNthCalledWith(2, "Site B shows Y.");
25432551expect(answerDraftStream.update).toHaveBeenNthCalledWith(3, "Final answer");
@@ -2579,7 +2587,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
25792587await dispatchWithContext({ context: createContext() });
2580258825812589expect(answerDraftStream.updatePreview).toHaveBeenCalledWith(
2582-expect.objectContaining({ text: expect.stringMatching(/🛠️ Exec$/) }),
2590+expect.objectContaining({ text: expect.stringMatching(/🛠️ Exec<\/b>$/) }),
25832591);
25842592expect(answerDraftStream.update).toHaveBeenNthCalledWith(1, "Branch is up to date");
25852593expect(answerDraftStream.forceNewMessage).toHaveBeenCalledTimes(1);
@@ -2605,7 +2613,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
26052613await dispatchWithContext({ context: createContext() });
2606261426072615expect(answerDraftStream.updatePreview).toHaveBeenCalledWith(
2608-expect.objectContaining({ text: expect.stringMatching(/🛠️ Exec$/) }),
2616+expect.objectContaining({ text: expect.stringMatching(/🛠️ Exec<\/b>$/) }),
26092617);
26102618expect(answerDraftStream.update).toHaveBeenNthCalledWith(1, "Branch is up to date");
26112619expect(answerDraftStream.forceNewMessage).toHaveBeenCalledTimes(1);
@@ -2762,9 +2770,10 @@ describe("dispatchTelegramMessage draft streaming", () => {
27622770expect.objectContaining({ text: expect.stringContaining("stdout line one") }),
27632771);
27642772expect(answerDraftStream.updatePreview).toHaveBeenLastCalledWith(
2765-expect.objectContaining({
2766-text: "Shelling\n\n🛠️ Exec\n🔎 Web Search: docs lookup",
2767-}),
2773+telegramProgressPreview(
2774+"Shelling\n\n🛠️ Exec\n🔎 Web Search: docs lookup",
2775+"<b>Shelling</b>\n<b>🛠️ Exec</b>\n<b>🔎 Web Search</b> <code>docs lookup</code>",
2776+),
27682777);
27692778expect(deliverReplies).not.toHaveBeenCalled();
27702779});
@@ -3318,7 +3327,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
33183327const updateBeforeStatusReaction = draftStream.updatePreview.mock.calls.at(-1)?.[0]?.text;
33193328releaseSetTool?.();
33203329await pendingToolStart;
3321-expect(updateBeforeStatusReaction).toBe("Shelling\n\n🛠️ Exec");
3330+expect(updateBeforeStatusReaction).toBe("<b>Shelling</b><br><b>🛠️ Exec</b>");
33223331return { queuedFinal: false };
33233332});
33243333此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。