tune-basic-toolset 0.1.22 → 0.2.0
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/package.json +1 -1
- package/src/mistral_ocr.tool.js +6 -1
- package/src/text.proc.js +1 -1
package/package.json
CHANGED
package/src/mistral_ocr.tool.js
CHANGED
|
@@ -4,6 +4,7 @@ const MIME_TYPES = {
|
|
|
4
4
|
// Documents → document_url
|
|
5
5
|
'.pdf': { kind: 'document', mime: 'application/pdf' },
|
|
6
6
|
'.docx': { kind: 'document', mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' },
|
|
7
|
+
'.xlsx': { kind: 'document', mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' },
|
|
7
8
|
'.pptx': { kind: 'document', mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' },
|
|
8
9
|
'.txt': { kind: 'document', mime: 'text/plain' },
|
|
9
10
|
'.epub': { kind: 'document', mime: 'application/epub+zip' },
|
|
@@ -42,7 +43,11 @@ module.exports = async function mistralOcr({ filename }, ctx) {
|
|
|
42
43
|
throw new Error(`Unsupported file extension: ${ext}`);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
const
|
|
46
|
+
const node = await ctx.resolve(filename)
|
|
47
|
+
if (!node) {
|
|
48
|
+
return `${filename} not found`
|
|
49
|
+
}
|
|
50
|
+
const buf = await node.read(true);
|
|
46
51
|
const base64 = buf.toString('base64');
|
|
47
52
|
const dataUrl = `data:${typeInfo.mime};base64,${base64}`;
|
|
48
53
|
|