@blank-utils/llm 0.3.11 → 0.3.12

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.
@@ -1101,10 +1101,10 @@ ${newText}` : newText);
1101
1101
  }
1102
1102
 
1103
1103
  // src/react/components.tsx
1104
- import { RotateCcw, ChevronDown, AlertCircleIcon } from "lucide-react";
1104
+ import { RotateCcw, ChevronDown, AlertCircle } from "lucide-react";
1105
1105
  import { clsx } from "clsx";
1106
1106
  import { twMerge } from "tailwind-merge";
1107
- import { Streamdown } from "streamdown";
1107
+ import { Streamdown, parseMarkdownIntoBlocks } from "streamdown";
1108
1108
  import { code } from "@streamdown/code";
1109
1109
  import { mermaid } from "@streamdown/mermaid";
1110
1110
  import { math } from "@streamdown/math";
@@ -1113,9 +1113,14 @@ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1113
1113
  function cn(...inputs) {
1114
1114
  return twMerge(clsx(inputs));
1115
1115
  }
1116
+ function sanitizeMarkdownLanguageBlocks(markdown) {
1117
+ let cleanMarkdown = markdown;
1118
+ cleanMarkdown = cleanMarkdown.replace(/```(?:mer|merma|mermai|mmd)\n/gi, "```mermaid\n");
1119
+ return parseMarkdownIntoBlocks(cleanMarkdown);
1120
+ }
1116
1121
  var CustomMermaidError = ({ error, retry }) => /* @__PURE__ */ jsxs3("div", { className: "rounded-lg border border-red-500/20 bg-red-500/10 p-4 my-4 font-sans", children: [
1117
1122
  /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
1118
- /* @__PURE__ */ jsx3("span", { className: "text-xl", children: /* @__PURE__ */ jsx3(AlertCircleIcon, { className: "text-red-500" }) }),
1123
+ /* @__PURE__ */ jsx3("span", { className: "text-xl", children: /* @__PURE__ */ jsx3(AlertCircle, { className: "w-5 h-5 text-red-500" }) }),
1119
1124
  /* @__PURE__ */ jsx3("p", { className: "font-semibold text-red-500 text-sm", children: "Failed to render Mermaid diagram" })
1120
1125
  ] }),
1121
1126
  /* @__PURE__ */ jsx3("div", { className: "mt-2 text-red-400/80 text-xs overflow-x-auto whitespace-pre-wrap font-mono", children: error }),
@@ -1448,6 +1453,7 @@ function Chat({
1448
1453
  isAnimating: false,
1449
1454
  mermaid: mermaidOptions,
1450
1455
  controls: streamdownControls,
1456
+ parseMarkdownIntoBlocksFn: sanitizeMarkdownLanguageBlocks,
1451
1457
  children: msg.content
1452
1458
  }
1453
1459
  ) })
@@ -1460,6 +1466,7 @@ function Chat({
1460
1466
  isAnimating: false,
1461
1467
  mermaid: mermaidOptions,
1462
1468
  controls: streamdownControls,
1469
+ parseMarkdownIntoBlocksFn: sanitizeMarkdownLanguageBlocks,
1463
1470
  children: msg.content
1464
1471
  }
1465
1472
  ) }) }, i)),
@@ -1472,6 +1479,7 @@ function Chat({
1472
1479
  isAnimating: isGenerating,
1473
1480
  mermaid: mermaidOptions,
1474
1481
  controls: streamdownControls,
1482
+ parseMarkdownIntoBlocksFn: sanitizeMarkdownLanguageBlocks,
1475
1483
  children: streamingText
1476
1484
  }
1477
1485
  ) }) }),
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  useCompletion,
27
27
  useLLM,
28
28
  useStream
29
- } from "./chunk-D3AYWZX2.js";
29
+ } from "./chunk-NTJ4KYT3.js";
30
30
  export {
31
31
  Chat,
32
32
  ChatInput,
@@ -9,7 +9,7 @@ import {
9
9
  useCompletion,
10
10
  useLLM,
11
11
  useStream
12
- } from "../chunk-D3AYWZX2.js";
12
+ } from "../chunk-NTJ4KYT3.js";
13
13
  export {
14
14
  Chat,
15
15
  ChatApp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blank-utils/llm",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Run LLMs directly in your browser with WebGPU acceleration. Supports React hooks and eager background loading.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",