@ai-matrx/print 0.8.6 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/document.js CHANGED
@@ -4814,7 +4814,8 @@ import { gfm } from "micromark-extension-gfm";
4814
4814
  import { escapeHtml as escapeHtml3 } from "@ai-matrx/kit/html-escape";
4815
4815
  function removeThinkingContent(content) {
4816
4816
  if (!content) return "";
4817
- let result = content.replace(/\n*<thinking>[\s\S]*?<\/thinking>\n*/gi, "\n").replace(/\n*<think>[\s\S]*?<\/think>\n*/gi, "\n").replace(/\n*<reasoning>[\s\S]*?<\/reasoning>\n*/gi, "\n");
4817
+ const hide = (_match, before, after) => before.length >= 2 || after.length >= 2 ? "\n\n" : "\n";
4818
+ let result = content.replace(/(\n*)<thinking>[\s\S]*?<\/thinking>(\n*)/gi, hide).replace(/(\n*)<think>[\s\S]*?<\/think>(\n*)/gi, hide).replace(/(\n*)<reasoning>[\s\S]*?<\/reasoning>(\n*)/gi, hide);
4818
4819
  result = result.replace(/\n{3,}/g, "\n\n");
4819
4820
  return result.trim();
4820
4821
  }