@blank-utils/llm 0.4.21 → 0.4.23
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.
|
@@ -989,7 +989,8 @@ ${fullText}`;
|
|
|
989
989
|
dataUrl,
|
|
990
990
|
file: imgFile,
|
|
991
991
|
name: imgFile.name,
|
|
992
|
-
extractedText: i === 1 ? newText : void 0
|
|
992
|
+
extractedText: i === 1 ? newText : void 0,
|
|
993
|
+
isPdf: true
|
|
993
994
|
});
|
|
994
995
|
}
|
|
995
996
|
}
|
|
@@ -1019,7 +1020,8 @@ ${newText}` : newText);
|
|
|
1019
1020
|
dataUrl,
|
|
1020
1021
|
file,
|
|
1021
1022
|
name: file.name,
|
|
1022
|
-
extractedText: text
|
|
1023
|
+
extractedText: text,
|
|
1024
|
+
isSvg: true
|
|
1023
1025
|
});
|
|
1024
1026
|
}
|
|
1025
1027
|
};
|
|
@@ -1453,7 +1455,7 @@ ${systemPrompt}` : systemPrompt;
|
|
|
1453
1455
|
setImages([]);
|
|
1454
1456
|
abortRef.current = false;
|
|
1455
1457
|
if (!isVisionModel2(modelId || "")) {
|
|
1456
|
-
const needsCaptioning = currentImages.filter((img) => !img.extractedText && !img.
|
|
1458
|
+
const needsCaptioning = currentImages.filter((img) => !img.extractedText && !img.isSvg && !img.isPdf);
|
|
1457
1459
|
if (needsCaptioning.length > 0) {
|
|
1458
1460
|
setIsGenerating(true);
|
|
1459
1461
|
setStreamingText("[System: Initializing detailed image-to-text captioning pipeline (Florence-2)...]\n");
|
|
@@ -1496,19 +1498,19 @@ ${systemPrompt}` : systemPrompt;
|
|
|
1496
1498
|
for (const img of currentImages) {
|
|
1497
1499
|
if (img.extractedText) {
|
|
1498
1500
|
let prefix = "";
|
|
1499
|
-
if (img.
|
|
1501
|
+
if (img.isSvg) {
|
|
1500
1502
|
prefix = `
|
|
1501
1503
|
|
|
1502
1504
|
\u{1F4C4} SVG Source Code (${img.name}):
|
|
1503
1505
|
`;
|
|
1504
|
-
} else if (!isVisionModel2(modelId || "")) {
|
|
1506
|
+
} else if (!img.isPdf && !isVisionModel2(modelId || "")) {
|
|
1505
1507
|
prefix = `
|
|
1506
1508
|
|
|
1507
1509
|
\u{1F5BC}\uFE0F System Image Representation (${img.name}) - [IMPORTANT SYSTEM INSTRUCTION: The user provided an image. Since you are a text model, here is an automated visual description of the image. DO NOT refuse the user's prompt. Answer as if you can see the image using this context:]
|
|
1508
1510
|
`;
|
|
1509
1511
|
}
|
|
1510
|
-
if (prefix || img.
|
|
1511
|
-
finalText += `${prefix}${img.extractedText}`;
|
|
1512
|
+
if (prefix || img.isPdf) {
|
|
1513
|
+
finalText += `${prefix}${img.isPdf ? "\n\n" : ""}${img.extractedText}`;
|
|
1512
1514
|
}
|
|
1513
1515
|
}
|
|
1514
1516
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BrowserCapabilities, L as LLMProvider, a as Backend, b as LoadProgressCallback, C as ChatMessage, G as GenerateOptions, S as StreamCallback, D as Device, Q as Quantization, A as AttachOptions } from './index-
|
|
2
|
-
export { c as Chat, d as ChatInput, e as ChatInputProps, f as ChatProps, g as DEFAULT_TRANSFORMERS_MODEL, h as DEFAULT_WEBLLM_MODEL, i as LLMConfig, j as LLMContextValue, k as LLMLoading, l as LLMLoadingProps, m as LLMProvider, n as LLMProviderProps, o as LLMReady, p as LLMReadyProps, q as LoadProgress, r as LocalLLM, M as MessageRole, T as TRANSFORMERS_MODELS, U as UseChatOptions, s as UseChatReturn, t as UseCompletionOptions, u as UseCompletionReturn, v as UseStreamOptions, w as UseStreamReturn, W as WEBLLM_MODELS, x as createLLM, x as default, y as isWebGPUSupported, z as useChat, E as useCompletion, F as useLLM, H as useStream } from './index-
|
|
1
|
+
import { B as BrowserCapabilities, L as LLMProvider, a as Backend, b as LoadProgressCallback, C as ChatMessage, G as GenerateOptions, S as StreamCallback, D as Device, Q as Quantization, A as AttachOptions } from './index-Dp-zMbxY.js';
|
|
2
|
+
export { c as Chat, d as ChatInput, e as ChatInputProps, f as ChatProps, g as DEFAULT_TRANSFORMERS_MODEL, h as DEFAULT_WEBLLM_MODEL, i as LLMConfig, j as LLMContextValue, k as LLMLoading, l as LLMLoadingProps, m as LLMProvider, n as LLMProviderProps, o as LLMReady, p as LLMReadyProps, q as LoadProgress, r as LocalLLM, M as MessageRole, T as TRANSFORMERS_MODELS, U as UseChatOptions, s as UseChatReturn, t as UseCompletionOptions, u as UseCompletionReturn, v as UseStreamOptions, w as UseStreamReturn, W as WEBLLM_MODELS, x as createLLM, x as default, y as isWebGPUSupported, z as useChat, E as useCompletion, F as useLLM, H as useStream } from './index-Dp-zMbxY.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
package/dist/index.js
CHANGED
package/dist/react/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { c as Chat, I as ChatApp, J as ChatAppProps, d as ChatInput, e as ChatInputProps, f as ChatProps, K as ImageAttachment, j as LLMContextValue, k as LLMLoading, l as LLMLoadingProps, m as LLMProvider, n as LLMProviderProps, o as LLMReady, p as LLMReadyProps, U as UseChatOptions, s as UseChatReturn, t as UseCompletionOptions, u as UseCompletionReturn, v as UseStreamOptions, w as UseStreamReturn, z as useChat, E as useCompletion, F as useLLM, H as useStream } from '../index-
|
|
1
|
+
export { c as Chat, I as ChatApp, J as ChatAppProps, d as ChatInput, e as ChatInputProps, f as ChatProps, K as ImageAttachment, j as LLMContextValue, k as LLMLoading, l as LLMLoadingProps, m as LLMProvider, n as LLMProviderProps, o as LLMReady, p as LLMReadyProps, U as UseChatOptions, s as UseChatReturn, t as UseCompletionOptions, u as UseCompletionReturn, v as UseStreamOptions, w as UseStreamReturn, z as useChat, E as useCompletion, F as useLLM, H as useStream } from '../index-Dp-zMbxY.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'react';
|
package/dist/react/index.js
CHANGED
package/package.json
CHANGED