@blank-utils/llm 0.3.7 → 0.3.8

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.
@@ -1105,14 +1105,28 @@ import { RotateCcw, ChevronDown } from "lucide-react";
1105
1105
  import { clsx } from "clsx";
1106
1106
  import { twMerge } from "tailwind-merge";
1107
1107
  import { Streamdown } from "streamdown";
1108
- import { code } from "@streamdown/code";
1109
- import { mermaid } from "@streamdown/mermaid";
1110
- import { math } from "@streamdown/math";
1108
+ import { createCodePlugin } from "@streamdown/code";
1109
+ import { createMermaidPlugin } from "@streamdown/mermaid";
1110
+ import { createMathPlugin } from "@streamdown/math";
1111
1111
  import "streamdown/styles.css";
1112
1112
  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
+ var codePlugin = createCodePlugin({
1117
+ themes: ["github-light", "github-dark"]
1118
+ });
1119
+ var mermaidPlugin = createMermaidPlugin({
1120
+ config: {
1121
+ theme: "base",
1122
+ themeVariables: {
1123
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
1124
+ }
1125
+ }
1126
+ });
1127
+ var mathPlugin = createMathPlugin({
1128
+ singleDollarTextMath: false
1129
+ });
1116
1130
  var DEFAULT_SYSTEM_PROMPT = `You are a helpful AI assistant.
1117
1131
  - You can use full Markdown (bold, italic, headers, lists).
1118
1132
  - You can use Code Blocks with language syntax highlighting.
@@ -1138,12 +1152,7 @@ var markdownComponents = {
1138
1152
  table: ({ children }) => /* @__PURE__ */ jsx3("div", { className: "my-4 w-full overflow-y-auto", children: /* @__PURE__ */ jsx3("table", { className: "w-full text-sm", children }) }),
1139
1153
  tr: ({ children }) => /* @__PURE__ */ jsx3("tr", { className: "m-0 border-t border-zinc-200 dark:border-zinc-800 p-0 even:bg-zinc-50 dark:even:bg-zinc-900/50", children }),
1140
1154
  th: ({ children }) => /* @__PURE__ */ jsx3("th", { className: "border border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-900 px-4 py-2 font-semibold text-zinc-900 dark:text-zinc-100 text-left [&[align=center]]:text-center [&[align=right]]:text-right", children }),
1141
- td: ({ children }) => /* @__PURE__ */ jsx3("td", { className: "border border-zinc-200 dark:border-zinc-700 px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right text-zinc-700 dark:text-zinc-300", children }),
1142
- pre: ({ children }) => /* @__PURE__ */ jsx3("pre", { className: "mt-4 mb-4 overflow-x-auto rounded-xl border border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-950 p-4 text-[13px] leading-relaxed font-mono shadow-sm", children }),
1143
- code: ({ children, className }) => {
1144
- const isInline = !className;
1145
- return /* @__PURE__ */ jsx3("code", { className: cn("font-mono text-[13px]", isInline ? "bg-zinc-100 dark:bg-zinc-800/60 rounded-md px-1.5 py-0.5 border border-zinc-200 dark:border-zinc-700 text-zinc-800 dark:text-zinc-300" : ""), children });
1146
- }
1155
+ td: ({ children }) => /* @__PURE__ */ jsx3("td", { className: "border border-zinc-200 dark:border-zinc-700 px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right text-zinc-700 dark:text-zinc-300", children })
1147
1156
  };
1148
1157
  function ModelSelector({
1149
1158
  currentModel,
@@ -1407,9 +1416,9 @@ function Chat({
1407
1416
  ] }),
1408
1417
  messages.map((msg, i) => /* @__PURE__ */ jsx3("div", { className: cn("flex flex-col max-w-[85%]", msg.role === "user" ? "self-end" : "self-start w-full"), children: msg.role === "user" ? /* @__PURE__ */ jsxs3("div", { className: "bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 px-5 py-3.5 rounded-[24px] rounded-br-[8px] sm:px-6 shadow-sm border border-zinc-200 dark:border-zinc-700/50", children: [
1409
1418
  msg.images && msg.images.length > 0 && /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap gap-2 mb-3 mt-1", children: msg.images.map((img) => /* @__PURE__ */ jsx3("img", { src: img.dataUrl, className: "w-24 h-24 object-cover rounded-xl border border-zinc-200 dark:border-zinc-700 shadow-sm", alt: "attachment" }, img.id)) }),
1410
- /* @__PURE__ */ jsx3("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx3(Streamdown, { plugins: { code, mermaid, math }, components: markdownComponents, animated: true, isAnimating: false, children: msg.content }) })
1411
- ] }) : /* @__PURE__ */ jsx3("div", { className: "prose prose-sm dark:prose-invert max-w-none px-2 w-full min-w-0", children: /* @__PURE__ */ jsx3(Streamdown, { plugins: { code, mermaid, math }, components: markdownComponents, animated: true, isAnimating: false, children: msg.content }) }) }, i)),
1412
- streamingText && /* @__PURE__ */ jsx3("div", { className: "flex flex-col self-start w-full max-w-[85%]", children: /* @__PURE__ */ jsx3("div", { className: "prose prose-sm dark:prose-invert max-w-none px-2 w-full min-w-0", children: /* @__PURE__ */ jsx3(Streamdown, { plugins: { code, mermaid, math }, components: markdownComponents, animated: true, isAnimating: isGenerating, children: streamingText }) }) }),
1419
+ /* @__PURE__ */ jsx3("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx3(Streamdown, { plugins: { code: codePlugin, mermaid: mermaidPlugin, math: mathPlugin }, components: markdownComponents, animated: true, isAnimating: false, children: msg.content }) })
1420
+ ] }) : /* @__PURE__ */ jsx3("div", { className: "prose prose-sm dark:prose-invert max-w-none px-2 w-full min-w-0", children: /* @__PURE__ */ jsx3(Streamdown, { plugins: { code: codePlugin, mermaid: mermaidPlugin, math: mathPlugin }, components: markdownComponents, animated: true, isAnimating: false, children: msg.content }) }) }, i)),
1421
+ streamingText && /* @__PURE__ */ jsx3("div", { className: "flex flex-col self-start w-full max-w-[85%]", children: /* @__PURE__ */ jsx3("div", { className: "prose prose-sm dark:prose-invert max-w-none px-2 w-full min-w-0", children: /* @__PURE__ */ jsx3(Streamdown, { plugins: { code: codePlugin, mermaid: mermaidPlugin, math: mathPlugin }, components: markdownComponents, animated: true, isAnimating: isGenerating, children: streamingText }) }) }),
1413
1422
  /* @__PURE__ */ jsx3("div", { ref: messagesEndRef, className: "h-4" })
1414
1423
  ] }),
1415
1424
  /* @__PURE__ */ jsx3("div", { className: "p-4 bg-white/80 dark:bg-zinc-950/80 backdrop-blur-xl border-t border-zinc-100 dark:border-zinc-800/80", children: /* @__PURE__ */ jsx3(
package/dist/index.css CHANGED
@@ -2217,9 +2217,6 @@ video {
2217
2217
  .block {
2218
2218
  display: block;
2219
2219
  }
2220
- .inline {
2221
- display: inline;
2222
- }
2223
2220
  .flex {
2224
2221
  display: flex;
2225
2222
  }
@@ -2396,9 +2393,6 @@ video {
2396
2393
  .overflow-hidden {
2397
2394
  overflow: hidden;
2398
2395
  }
2399
- .overflow-x-auto {
2400
- overflow-x: auto;
2401
- }
2402
2396
  .overflow-y-auto {
2403
2397
  overflow-y: auto;
2404
2398
  }
@@ -2425,9 +2419,6 @@ video {
2425
2419
  .rounded-lg {
2426
2420
  border-radius: 0.5rem;
2427
2421
  }
2428
- .rounded-md {
2429
- border-radius: 0.375rem;
2430
- }
2431
2422
  .rounded-xl {
2432
2423
  border-radius: 0.75rem;
2433
2424
  }
@@ -2645,17 +2636,6 @@ video {
2645
2636
  .text-center {
2646
2637
  text-align: center;
2647
2638
  }
2648
- .font-mono {
2649
- font-family:
2650
- ui-monospace,
2651
- SFMono-Regular,
2652
- Menlo,
2653
- Monaco,
2654
- Consolas,
2655
- "Liberation Mono",
2656
- "Courier New",
2657
- monospace;
2658
- }
2659
2639
  .text-2xl {
2660
2640
  font-size: 1.5rem;
2661
2641
  line-height: 2rem;
@@ -2667,9 +2647,6 @@ video {
2667
2647
  .text-\[10px\] {
2668
2648
  font-size: 10px;
2669
2649
  }
2670
- .text-\[13px\] {
2671
- font-size: 13px;
2672
- }
2673
2650
  .text-\[15px\] {
2674
2651
  font-size: 15px;
2675
2652
  }
@@ -3044,9 +3021,6 @@ video {
3044
3021
  --tw-bg-opacity: 1;
3045
3022
  background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
3046
3023
  }
3047
- .dark\:bg-zinc-800\/60 {
3048
- background-color: rgb(39 39 42 / 0.6);
3049
- }
3050
3024
  .dark\:bg-zinc-900 {
3051
3025
  --tw-bg-opacity: 1;
3052
3026
  background-color: rgb(24 24 27 / var(--tw-bg-opacity, 1));
@@ -3060,10 +3034,6 @@ video {
3060
3034
  .dark\:bg-zinc-900\/90 {
3061
3035
  background-color: rgb(24 24 27 / 0.9);
3062
3036
  }
3063
- .dark\:bg-zinc-950 {
3064
- --tw-bg-opacity: 1;
3065
- background-color: rgb(9 9 11 / var(--tw-bg-opacity, 1));
3066
- }
3067
3037
  .dark\:bg-zinc-950\/80 {
3068
3038
  background-color: rgb(9 9 11 / 0.8);
3069
3039
  }
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  useCompletion,
27
27
  useLLM,
28
28
  useStream
29
- } from "./chunk-D66WXG2F.js";
29
+ } from "./chunk-SGV7RTM4.js";
30
30
  export {
31
31
  Chat,
32
32
  ChatInput,
@@ -2217,9 +2217,6 @@ video {
2217
2217
  .block {
2218
2218
  display: block;
2219
2219
  }
2220
- .inline {
2221
- display: inline;
2222
- }
2223
2220
  .flex {
2224
2221
  display: flex;
2225
2222
  }
@@ -2396,9 +2393,6 @@ video {
2396
2393
  .overflow-hidden {
2397
2394
  overflow: hidden;
2398
2395
  }
2399
- .overflow-x-auto {
2400
- overflow-x: auto;
2401
- }
2402
2396
  .overflow-y-auto {
2403
2397
  overflow-y: auto;
2404
2398
  }
@@ -2425,9 +2419,6 @@ video {
2425
2419
  .rounded-lg {
2426
2420
  border-radius: 0.5rem;
2427
2421
  }
2428
- .rounded-md {
2429
- border-radius: 0.375rem;
2430
- }
2431
2422
  .rounded-xl {
2432
2423
  border-radius: 0.75rem;
2433
2424
  }
@@ -2645,17 +2636,6 @@ video {
2645
2636
  .text-center {
2646
2637
  text-align: center;
2647
2638
  }
2648
- .font-mono {
2649
- font-family:
2650
- ui-monospace,
2651
- SFMono-Regular,
2652
- Menlo,
2653
- Monaco,
2654
- Consolas,
2655
- "Liberation Mono",
2656
- "Courier New",
2657
- monospace;
2658
- }
2659
2639
  .text-2xl {
2660
2640
  font-size: 1.5rem;
2661
2641
  line-height: 2rem;
@@ -2667,9 +2647,6 @@ video {
2667
2647
  .text-\[10px\] {
2668
2648
  font-size: 10px;
2669
2649
  }
2670
- .text-\[13px\] {
2671
- font-size: 13px;
2672
- }
2673
2650
  .text-\[15px\] {
2674
2651
  font-size: 15px;
2675
2652
  }
@@ -3044,9 +3021,6 @@ video {
3044
3021
  --tw-bg-opacity: 1;
3045
3022
  background-color: rgb(39 39 42 / var(--tw-bg-opacity, 1));
3046
3023
  }
3047
- .dark\:bg-zinc-800\/60 {
3048
- background-color: rgb(39 39 42 / 0.6);
3049
- }
3050
3024
  .dark\:bg-zinc-900 {
3051
3025
  --tw-bg-opacity: 1;
3052
3026
  background-color: rgb(24 24 27 / var(--tw-bg-opacity, 1));
@@ -3060,10 +3034,6 @@ video {
3060
3034
  .dark\:bg-zinc-900\/90 {
3061
3035
  background-color: rgb(24 24 27 / 0.9);
3062
3036
  }
3063
- .dark\:bg-zinc-950 {
3064
- --tw-bg-opacity: 1;
3065
- background-color: rgb(9 9 11 / var(--tw-bg-opacity, 1));
3066
- }
3067
3037
  .dark\:bg-zinc-950\/80 {
3068
3038
  background-color: rgb(9 9 11 / 0.8);
3069
3039
  }
@@ -9,7 +9,7 @@ import {
9
9
  useCompletion,
10
10
  useLLM,
11
11
  useStream
12
- } from "../chunk-D66WXG2F.js";
12
+ } from "../chunk-SGV7RTM4.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.7",
3
+ "version": "0.3.8",
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",