fix(slack): recognize MiniMax mm: namespaced reasoning tags in monitor preview (#93874)

This commit is contained in:
Alix-007
2026-06-17 11:44:19 +08:00
committed by GitHub
parent 12eeb5cb63
commit d2bf67f4b7
2 changed files with 27 additions and 1 deletions

View File

@@ -1829,6 +1829,31 @@ describe("dispatchPreparedSlackMessage preview fallback", () => {
expect(updates.join("\n")).not.toContain("Checking Reading");
});
it("extracts mm:think reasoning snapshots for Slack progress draft previews", async () => {
const draftStream = createDraftStreamStub();
createSlackDraftStreamMock.mockReturnValueOnce(draftStream);
mockedDispatchSequence = [];
mockedReplyOptionEvents = [
{
kind: "reasoning",
text: "<mm:think>Reading\nChecking</mm:think>",
isReasoningSnapshot: true,
},
];
await dispatchPreparedSlackMessage(
createPreparedSlackMessage({
accountConfig: { streaming: { progress: { label: "Shelling" } } },
}),
);
expect(draftStream.update).toHaveBeenLastCalledWith(
["Shelling", "• Reading Checking"].join("\n"),
);
const updates = draftStream.update.mock.calls.map((call) => String(call[0]));
expect(updates.join("\n")).toContain("Reading Checking");
});
it("keeps plain Slack reasoning content that starts with Thinking", async () => {
const draftStream = createDraftStreamStub();
createSlackDraftStreamMock.mockReturnValueOnce(draftStream);

View File

@@ -122,7 +122,8 @@ const UNICODE_TO_SLACK: Record<string, string> = {
"🛠️": "hammer_and_wrench",
"💻": "computer",
};
const SLACK_REASONING_TAG_RE = /<\s*(\/?)\s*(?:think(?:ing)?|thought|antthinking)\b[^<>]*>/gi;
const SLACK_REASONING_TAG_RE =
/<\s*(\/?)\s*(?:(?:antml:|mm:)?(?:think(?:ing)?|thought)|antthinking)\b[^<>]*>/gi;
const SLACK_REASONING_LABEL_PREFIX_RE = /^\s*(?:>\s*)?Reasoning:\s*/iu;
const SLACK_THINKING_LABEL_PREFIX_RE = /^\s*(?:>\s*)?Thinking\.{0,3}(?=\s*(?:\n|_))/iu;