@blank-utils/llm 0.3.2 → 0.3.4

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/README.md CHANGED
@@ -21,8 +21,10 @@
21
21
  - ⚛️ **React hooks** — `useChat`, `useStream`, `useCompletion` with eager background loading
22
22
  - 🔤 **Type-safe model selection** — full autocomplete for 30+ supported models across both backends
23
23
  - 📝 **Streaming support** — real-time token output with abort control
24
+ - 📄 **PDF & Image Processing** — Extract text from PDFs natively and easily pass multimodal image attachments
24
25
  - 🔄 **Message queueing** — users can type while models download; messages are processed once ready
25
26
  - 🧩 **Vanilla JS friendly** — works outside React with DOM helpers and a simple `createLLM()` API
27
+ - ⚡ **Instant Builds** — Bundled via `tsup` for lightning-fast compilation
26
28
  - 📦 **Zero config** — auto-detects WebGPU/WASM and picks the best backend
27
29
 
28
30
  ## Installation
@@ -408,6 +410,8 @@ import { ChatInput } from "@blank-utils/llm/react";
408
410
  - ⌨️ Enter to send, Shift+Enter for newline
409
411
  - ⏹️ Stop button while generating
410
412
  - 🎨 Dark/light theme support
413
+ - 📄 **Drag-and-drop or click to upload PDF files for automatic local text extraction (OCR)**
414
+ - 🖼️ **Paste/upload images directly into multimodal models**
411
415
 
412
416
  ---
413
417
 
@@ -508,10 +512,6 @@ You can use either the **alias** (short name) or the **full model ID** when spec
508
512
  | `qwen-2.5-7b` | Qwen 2.5 7B | Large |
509
513
  | `qwen-2.5-coder-0.5b` | Qwen 2.5 Coder 0.5B | Code-focused |
510
514
  | `qwen-2.5-coder-1.5b` | Qwen 2.5 Coder 1.5B | Code-focused |
511
- | `qwen-3-0.6b` | Qwen 3 0.6B | Latest gen |
512
- | `qwen-3-1.7b` | Qwen 3 1.7B | Latest gen |
513
- | `qwen-3-4b` | Qwen 3 4B | Latest gen |
514
- | `qwen-3-8b` | Qwen 3 8B | Latest gen |
515
515
  | `gemma-2-2b` | Gemma 2 2B | Google, efficient |
516
516
  | `gemma-2-2b-1k` | Gemma 2 2B (1K ctx) | Lower memory |
517
517
  | `gemma-2-9b` | Gemma 2 9B | Large |
@@ -532,7 +532,6 @@ You can use either the **alias** (short name) or the **full model ID** when spec
532
532
  | `qwen-2.5-1.5b` | `onnx-community/Qwen2.5-1.5B-Instruct` | Good quality |
533
533
  | `qwen-2.5-coder-0.5b` | `onnx-community/Qwen2.5-Coder-0.5B-Instruct` | Code |
534
534
  | `qwen-2.5-coder-1.5b` | `onnx-community/Qwen2.5-Coder-1.5B-Instruct` | Code |
535
- | `qwen-3-0.6b` | `onnx-community/Qwen3-0.6B-ONNX` | Latest gen |
536
535
  | `smollm2-135m` | `HuggingFaceTB/SmolLM2-135M-Instruct` | Ultra fast |
537
536
  | `smollm2-360m` | `HuggingFaceTB/SmolLM2-360M-Instruct` | Fast |
538
537
  | `smollm2-1.7b` | `HuggingFaceTB/SmolLM2-1.7B-Instruct` | Good |
@@ -586,13 +585,10 @@ bun test
586
585
 
587
586
  ### Build Pipeline
588
587
 
589
- | Script | What it does |
590
- | ------------- | ------------------------------------------------------------------------------------------------------------------ |
591
- | `clean` | Removes `dist/` |
592
- | `build:js` | Bundles `src/index.ts` `dist/index.js` and `src/react/index.tsx` `dist/react/index.js` (ESM, externals: react) |
593
- | `postbuild` | Copies WASM + ONNX runtime assets into `dist/` and `dist/react/` |
594
- | `build:types` | Generates `.d.ts` declaration files via `tsc` |
595
- | `build` | Runs all of the above in sequence |
588
+ | Script | What it does |
589
+ | ------- | ---------------------------------------------------------- |
590
+ | `clean` | Removes `dist/` |
591
+ | `build` | Super-fast bundling via `tsup`, compiling ESM code & types |
596
592
 
597
593
  ### Package Exports
598
594
 
@@ -1551,10 +1551,13 @@ function injectChatStyles(theme) {
1551
1551
  .llm-chat-bubble--user {
1552
1552
  align-self: flex-end;
1553
1553
  max-width: 80%;
1554
+ overflow-wrap: break-word;
1554
1555
  }
1555
1556
  .llm-chat-bubble--assistant {
1556
1557
  align-self: flex-start;
1557
1558
  width: 100%;
1559
+ min-width: 0; /* Prevents flex children from expanding past 100% */
1560
+ overflow-x: hidden;
1558
1561
  }
1559
1562
 
1560
1563
  /* User message \u2014 flat, subtle bg, no radius */
@@ -1568,30 +1571,96 @@ function injectChatStyles(theme) {
1568
1571
  color: ${text};
1569
1572
  }
1570
1573
 
1571
- /* Assistant message */
1574
+ /* Streamdown Overrides / Markdown Styling */
1572
1575
  .llm-chat-assistant-content {
1573
1576
  font-size: 14px;
1574
1577
  line-height: 1.7;
1575
- color: ${d ? "rgba(255,255,255,0.85)" : "rgba(0,0,0,0.85)"};
1578
+ color: ${text};
1579
+ word-wrap: break-word;
1580
+ }
1581
+ .llm-chat-assistant-content > *:first-child { margin-top: 0; }
1582
+ .llm-chat-assistant-content > *:last-child { margin-bottom: 0; }
1583
+
1584
+ .llm-chat-assistant-content p {
1585
+ margin: 0 0 12px 0;
1586
+ }
1587
+
1588
+ .llm-chat-assistant-content h1,
1589
+ .llm-chat-assistant-content h2,
1590
+ .llm-chat-assistant-content h3,
1591
+ .llm-chat-assistant-content h4 {
1592
+ margin: 20px 0 10px 0;
1593
+ color: ${text};
1594
+ font-weight: 600;
1595
+ line-height: 1.3;
1596
+ }
1597
+ .llm-chat-assistant-content h1 { font-size: 1.5em; }
1598
+ .llm-chat-assistant-content h2 { font-size: 1.3em; }
1599
+ .llm-chat-assistant-content h3 { font-size: 1.1em; }
1600
+
1601
+ .llm-chat-assistant-content ul,
1602
+ .llm-chat-assistant-content ol {
1603
+ margin: 0 0 12px 0;
1604
+ padding-left: 24px;
1605
+ }
1606
+ .llm-chat-assistant-content li {
1607
+ margin-bottom: 4px;
1576
1608
  }
1577
1609
 
1578
- /* Streamdown Overrides */
1579
1610
  .llm-chat-assistant-content pre {
1580
1611
  background: ${surfaceSubtle} !important;
1581
1612
  border: 1px solid ${borderSubtle} !important;
1582
- border-radius: 0 !important;
1613
+ border-radius: 6px !important;
1583
1614
  padding: 12px !important;
1584
1615
  margin: 12px 0 !important;
1616
+ overflow-x: auto !important;
1617
+ white-space: pre !important;
1618
+ max-width: 100%;
1585
1619
  }
1586
1620
  .llm-chat-assistant-content code {
1587
1621
  font-family: ${monoFont} !important;
1588
1622
  font-size: 13px !important;
1623
+ white-space: inherit;
1589
1624
  }
1590
1625
  .llm-chat-assistant-content :not(pre) > code {
1591
1626
  background: ${surfaceSubtle};
1592
1627
  border: 1px solid ${borderSubtle};
1593
- padding: 1px 5px;
1628
+ border-radius: 4px;
1629
+ padding: 2px 5px;
1594
1630
  font-size: 12.5px !important;
1631
+ white-space: pre-wrap !important;
1632
+ word-break: break-word;
1633
+ }
1634
+
1635
+ .llm-chat-assistant-content blockquote {
1636
+ border-left: 3px solid ${borderSubtle};
1637
+ margin: 0 0 12px 0;
1638
+ padding-left: 12px;
1639
+ color: ${textTertiary};
1640
+ }
1641
+
1642
+ .llm-chat-assistant-content a {
1643
+ color: #3b82f6;
1644
+ text-decoration: none;
1645
+ }
1646
+ .llm-chat-assistant-content a:hover {
1647
+ text-decoration: underline;
1648
+ }
1649
+
1650
+ .llm-chat-assistant-content table {
1651
+ border-collapse: collapse;
1652
+ width: 100%;
1653
+ margin: 12px 0;
1654
+ }
1655
+ .llm-chat-assistant-content th,
1656
+ .llm-chat-assistant-content td {
1657
+ border: 1px solid ${borderSubtle};
1658
+ padding: 6px 10px;
1659
+ text-align: left;
1660
+ }
1661
+ .llm-chat-assistant-content th {
1662
+ background: ${surfaceSubtle};
1663
+ font-weight: 600;
1595
1664
  }
1596
1665
 
1597
1666
  /* Attachments in message */
@@ -1923,7 +1992,7 @@ function Chat({
1923
1992
  ] }),
1924
1993
  messages.map((msg, i) => /* @__PURE__ */ jsx3("div", { className: `llm-chat-bubble llm-chat-bubble--${msg.role}`, children: msg.role === "user" ? /* @__PURE__ */ jsxs3(Fragment3, { children: [
1925
1994
  msg.images && msg.images.length > 0 && /* @__PURE__ */ jsx3("div", { className: "llm-chat-msg-images", children: msg.images.map((img) => /* @__PURE__ */ jsx3("img", { src: img.dataUrl, className: "llm-chat-msg-img", alt: "attachment" }, img.id)) }),
1926
- /* @__PURE__ */ jsx3("div", { className: "llm-chat-user-content", children: msg.content })
1995
+ /* @__PURE__ */ jsx3("div", { className: "llm-chat-user-content", style: { padding: "0px" }, children: /* @__PURE__ */ jsx3("div", { className: "llm-chat-assistant-content", style: { padding: "10px 14px" }, children: /* @__PURE__ */ jsx3(Streamdown, { plugins: { code, mermaid }, children: msg.content }) }) })
1927
1996
  ] }) : /* @__PURE__ */ jsx3("div", { className: "llm-chat-assistant-content", children: /* @__PURE__ */ jsx3(
1928
1997
  Streamdown,
1929
1998
  {
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  useCompletion,
27
27
  useLLM,
28
28
  useStream
29
- } from "./chunk-PNVU6364.js";
29
+ } from "./chunk-365XIJLC.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-PNVU6364.js";
12
+ } from "../chunk-365XIJLC.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.2",
3
+ "version": "0.3.4",
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",