@blank-utils/llm 0.5.0 → 0.5.1

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.
@@ -1215,33 +1215,19 @@ ${systemPrompt}` : systemPrompt;
1215
1215
  currentMessages.forEach((m) => {
1216
1216
  let content = m.content;
1217
1217
  if (m.role === "user" && m.images && m.images.length > 0 && isVisionModel(modelId || "")) {
1218
- if (llm.backend === "webllm") {
1219
- content = [
1220
- { type: "text", text: m.content },
1221
- ...m.images.map((img) => ({ type: "image_url", image_url: { url: img.dataUrl } }))
1222
- ];
1223
- } else {
1224
- content = [
1225
- ...m.images.map((img) => ({ type: "image", image: img.dataUrl })),
1226
- { type: "text", text: m.content }
1227
- ];
1228
- }
1218
+ content = [
1219
+ { type: "text", text: m.content },
1220
+ ...m.images.map((img) => ({ type: "image_url", image_url: { url: img.dataUrl } }))
1221
+ ];
1229
1222
  }
1230
1223
  apiMessages.push({ role: m.role, content });
1231
1224
  });
1232
1225
  let finalUserContent = userContent;
1233
1226
  if (attachedImages.length > 0 && isVisionModel(modelId || "")) {
1234
- if (llm.backend === "webllm") {
1235
- finalUserContent = [
1236
- { type: "text", text: userContent },
1237
- ...attachedImages.map((img) => ({ type: "image_url", image_url: { url: img.dataUrl } }))
1238
- ];
1239
- } else {
1240
- finalUserContent = [
1241
- ...attachedImages.map((img) => ({ type: "image", image: img.dataUrl })),
1242
- { type: "text", text: userContent }
1243
- ];
1244
- }
1227
+ finalUserContent = [
1228
+ { type: "text", text: userContent },
1229
+ ...attachedImages.map((img) => ({ type: "image_url", image_url: { url: img.dataUrl } }))
1230
+ ];
1245
1231
  }
1246
1232
  apiMessages.push({ role: "user", content: finalUserContent });
1247
1233
  try {
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  useCompletion,
23
23
  useLLM,
24
24
  useStream
25
- } from "./chunk-A7TUIC5G.js";
25
+ } from "./chunk-S375B33F.js";
26
26
  export {
27
27
  Chat,
28
28
  ChatInput,
@@ -9,7 +9,7 @@ import {
9
9
  useCompletion,
10
10
  useLLM,
11
11
  useStream
12
- } from "../chunk-A7TUIC5G.js";
12
+ } from "../chunk-S375B33F.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.5.0",
3
+ "version": "0.5.1",
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",
@@ -101,7 +101,7 @@
101
101
  },
102
102
  "dependencies": {
103
103
  "@huggingface/transformers": "^3.8.1",
104
- "@mlc-ai/web-llm": "^0.2.80",
104
+ "@mlc-ai/web-llm": "^0.2.81",
105
105
  "@streamdown/code": "^1.0.3",
106
106
  "@streamdown/math": "^1.0.2",
107
107
  "@streamdown/mermaid": "^1.0.2",