mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:30:57 +00:00
fix(channels): skip empty progress drafts
This commit is contained in:
@@ -2794,6 +2794,24 @@ describe("matrix monitor handler draft streaming", () => {
|
||||
await finish();
|
||||
});
|
||||
|
||||
it("does not create a blank Matrix progress draft when label and lines are disabled", async () => {
|
||||
const { dispatch } = createStreamingHarness({
|
||||
streaming: "progress",
|
||||
previewToolProgressEnabled: false,
|
||||
accountConfig: {
|
||||
streaming: { mode: "progress", progress: { label: false, toolProgress: false } },
|
||||
} as never,
|
||||
});
|
||||
const { opts, finish } = await dispatch();
|
||||
|
||||
await opts.onItemEvent?.({ progressText: "tool one" });
|
||||
await opts.onItemEvent?.({ progressText: "tool two" });
|
||||
|
||||
expect(opts.suppressDefaultToolProgressMessages).toBe(true);
|
||||
expect(sendSingleTextMessageMatrixMock).not.toHaveBeenCalled();
|
||||
await finish();
|
||||
});
|
||||
|
||||
it("keeps partial preview-first finalization on the existing draft when text is unchanged", async () => {
|
||||
const { dispatch, redactEventMock } = createStreamingHarness({
|
||||
blockStreamingEnabled: true,
|
||||
|
||||
@@ -1504,15 +1504,17 @@ export function createMatrixRoomMessageHandler(params: MatrixMonitorHandlerParam
|
||||
if (!draftStream || !progressDraftStreaming) {
|
||||
return;
|
||||
}
|
||||
draftStream.update(
|
||||
formatChannelProgressDraftText({
|
||||
entry: progressConfigEntry,
|
||||
lines: previewToolProgressLines,
|
||||
seed: progressSeed,
|
||||
formatLine: formatMatrixToolProgressMarkdownCode,
|
||||
bullet: "-",
|
||||
}),
|
||||
);
|
||||
const previewText = formatChannelProgressDraftText({
|
||||
entry: progressConfigEntry,
|
||||
lines: previewToolProgressLines,
|
||||
seed: progressSeed,
|
||||
formatLine: formatMatrixToolProgressMarkdownCode,
|
||||
bullet: "-",
|
||||
});
|
||||
if (!previewText) {
|
||||
return;
|
||||
}
|
||||
draftStream.update(previewText);
|
||||
};
|
||||
const progressDraftGate = createChannelProgressDraftGate({
|
||||
onStart: renderProgressDraft,
|
||||
|
||||
Reference in New Issue
Block a user