mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-07 22:44:16 +00:00
fix(discord): preserve non-reasoning replies with reasoning prefix text
This commit is contained in:
@@ -545,6 +545,27 @@ describe("processDiscordMessage draft streaming", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("does not drop non-reasoning final payloads that start with Reasoning prefix text", async () => {
|
||||
dispatchInboundMessage.mockImplementationOnce(async (params?: DispatchInboundParams) => {
|
||||
await params?.dispatcher.sendFinalReply({
|
||||
text: "Reasoning:\nThis heading is intentional user-facing content",
|
||||
});
|
||||
return { queuedFinal: true, counts: { final: 1, tool: 0, block: 0 } };
|
||||
});
|
||||
|
||||
await processStreamOffDiscordMessage();
|
||||
|
||||
expect(deliverDiscordReply).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
replies: [
|
||||
expect.objectContaining({
|
||||
text: "Reasoning:\nThis heading is intentional user-facing content",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("delivers non-reasoning block payloads to Discord", async () => {
|
||||
mockDispatchSingleBlockReply({ text: "hello from block stream" });
|
||||
await processStreamOffDiscordMessage();
|
||||
|
||||
@@ -596,11 +596,7 @@ export async function processDiscordMessage(ctx: DiscordMessagePreflightContext)
|
||||
if (typeof text !== "string") {
|
||||
return text;
|
||||
}
|
||||
const cleaned = stripReasoningTagsFromText(text, { mode: "strict", trim: "both" });
|
||||
if (cleaned.startsWith("Reasoning:\n")) {
|
||||
return "";
|
||||
}
|
||||
return cleaned;
|
||||
return stripReasoningTagsFromText(text, { mode: "strict", trim: "both" });
|
||||
};
|
||||
|
||||
// When draft streaming is active, suppress block streaming to avoid double-streaming.
|
||||
|
||||
Reference in New Issue
Block a user