@promptbook/markdown-utils 0.84.0-13 → 0.84.0-15
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/LICENSE.md +1 -0
- package/README.md +3 -3
- package/esm/index.es.js +17 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +12 -0
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
- package/package.json +2 -14
- package/umd/index.umd.js +16 -5
- package/umd/index.umd.js.map +1 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[Functional Source License, Version 1.1, ALv2 Future License](https://github.com/getsentry/fsl.software/blob/main/FSL-1.1-ALv2.template.md)
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# ✨ Promptbook
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
## ❄ New Features
|
|
18
18
|
|
|
19
|
+
- 🐋 **Support of [DeepSeek models](https://www.deepseek.com/)**
|
|
19
20
|
- 💙 Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
|
|
20
21
|
- 🖤 Run books from CLI - `npx ptbk run path/to/your/book`
|
|
21
|
-
- 📚 Support of `.docx`, `.doc` and `.pdf` documents
|
|
22
|
-
- ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
|
|
22
|
+
- 📚 Support of `.docx`, `.doc` and `.pdf` documents as knowledge
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
package/esm/index.es.js
CHANGED
|
@@ -6,7 +6,7 @@ import hexEncoder from 'crypto-js/enc-hex';
|
|
|
6
6
|
import sha256 from 'crypto-js/sha256';
|
|
7
7
|
import { basename, join, dirname } from 'path';
|
|
8
8
|
import { SHA256 } from 'crypto-js';
|
|
9
|
-
import { lookup } from 'mime-types';
|
|
9
|
+
import { lookup, extension } from 'mime-types';
|
|
10
10
|
import { unparse, parse } from 'papaparse';
|
|
11
11
|
|
|
12
12
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-
|
|
26
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-14';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3614,6 +3614,17 @@ function isFileExisting(filename, fs) {
|
|
|
3614
3614
|
* TODO: [🖇] What about symlinks?
|
|
3615
3615
|
*/
|
|
3616
3616
|
|
|
3617
|
+
/**
|
|
3618
|
+
* Convert mime type to file extension
|
|
3619
|
+
*
|
|
3620
|
+
* Note: If the mime type is invalid, `null` is returned
|
|
3621
|
+
*
|
|
3622
|
+
* @private within the repository
|
|
3623
|
+
*/
|
|
3624
|
+
function mimeTypeToExtension(value) {
|
|
3625
|
+
return extension(value) || null;
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3617
3628
|
/**
|
|
3618
3629
|
* Removes emojis from a string and fix whitespaces
|
|
3619
3630
|
*
|
|
@@ -3707,7 +3718,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3707
3718
|
case 1:
|
|
3708
3719
|
response_1 = _l.sent();
|
|
3709
3720
|
mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
|
|
3710
|
-
if (tools.fs === undefined || !url.endsWith('.pdf')) {
|
|
3721
|
+
if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [💵] */)) {
|
|
3711
3722
|
return [2 /*return*/, {
|
|
3712
3723
|
source: name,
|
|
3713
3724
|
filename: null,
|
|
@@ -3752,7 +3763,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3752
3763
|
basename = url.split('/').pop() || titleToName(url);
|
|
3753
3764
|
hash = sha256(hexEncoder.parse(url)).toString( /* hex */);
|
|
3754
3765
|
rootDirname_1 = join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
|
|
3755
|
-
filepath = join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".
|
|
3766
|
+
filepath = join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".").concat(mimeTypeToExtension(mimeType))], false));
|
|
3756
3767
|
return [4 /*yield*/, tools.fs.mkdir(dirname(join(rootDirname_1, filepath)), { recursive: true })];
|
|
3757
3768
|
case 2:
|
|
3758
3769
|
_l.sent();
|
|
@@ -3763,9 +3774,9 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3763
3774
|
case 3: return [4 /*yield*/, _g.apply(_f, _h.concat([_k.apply(_j, [_l.sent()])]))];
|
|
3764
3775
|
case 4:
|
|
3765
3776
|
_l.sent();
|
|
3766
|
-
// TODO:
|
|
3777
|
+
// TODO: [💵] Check the file security
|
|
3767
3778
|
// TODO: !!!!!!!! Check the file size (if it is not too big)
|
|
3768
|
-
// TODO: !!!!!!!! Delete the file
|
|
3779
|
+
// TODO: !!!!!!!! Delete the file after the scraping is done
|
|
3769
3780
|
return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
|
|
3770
3781
|
case 5:
|
|
3771
3782
|
if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];
|