@promptbook/remote-server 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 +3 -15
- 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
|
@@ -12,7 +12,7 @@ import { unparse, parse } from 'papaparse';
|
|
|
12
12
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
13
13
|
import sha256 from 'crypto-js/sha256';
|
|
14
14
|
import { SHA256 } from 'crypto-js';
|
|
15
|
-
import { lookup } from 'mime-types';
|
|
15
|
+
import { lookup, extension } from 'mime-types';
|
|
16
16
|
|
|
17
17
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
18
18
|
/**
|
|
@@ -28,7 +28,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-
|
|
31
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-14';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -6146,6 +6146,17 @@ function isFileExisting(filename, fs) {
|
|
|
6146
6146
|
* TODO: [🖇] What about symlinks?
|
|
6147
6147
|
*/
|
|
6148
6148
|
|
|
6149
|
+
/**
|
|
6150
|
+
* Convert mime type to file extension
|
|
6151
|
+
*
|
|
6152
|
+
* Note: If the mime type is invalid, `null` is returned
|
|
6153
|
+
*
|
|
6154
|
+
* @private within the repository
|
|
6155
|
+
*/
|
|
6156
|
+
function mimeTypeToExtension(value) {
|
|
6157
|
+
return extension(value) || null;
|
|
6158
|
+
}
|
|
6159
|
+
|
|
6149
6160
|
/**
|
|
6150
6161
|
* Removes emojis from a string and fix whitespaces
|
|
6151
6162
|
*
|
|
@@ -6239,7 +6250,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
6239
6250
|
case 1:
|
|
6240
6251
|
response_1 = _l.sent();
|
|
6241
6252
|
mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
|
|
6242
|
-
if (tools.fs === undefined || !url.endsWith('.pdf')) {
|
|
6253
|
+
if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [💵] */)) {
|
|
6243
6254
|
return [2 /*return*/, {
|
|
6244
6255
|
source: name,
|
|
6245
6256
|
filename: null,
|
|
@@ -6284,7 +6295,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
6284
6295
|
basename = url.split('/').pop() || titleToName(url);
|
|
6285
6296
|
hash = sha256(hexEncoder.parse(url)).toString( /* hex */);
|
|
6286
6297
|
rootDirname_1 = join(process.cwd(), DEFAULT_DOWNLOAD_CACHE_DIRNAME);
|
|
6287
|
-
filepath = join.apply(void 0, __spreadArray(__spreadArray([], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(basename.substring(0, MAX_FILENAME_LENGTH), ".
|
|
6298
|
+
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));
|
|
6288
6299
|
return [4 /*yield*/, tools.fs.mkdir(dirname(join(rootDirname_1, filepath)), { recursive: true })];
|
|
6289
6300
|
case 2:
|
|
6290
6301
|
_l.sent();
|
|
@@ -6295,9 +6306,9 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
6295
6306
|
case 3: return [4 /*yield*/, _g.apply(_f, _h.concat([_k.apply(_j, [_l.sent()])]))];
|
|
6296
6307
|
case 4:
|
|
6297
6308
|
_l.sent();
|
|
6298
|
-
// TODO:
|
|
6309
|
+
// TODO: [💵] Check the file security
|
|
6299
6310
|
// TODO: !!!!!!!! Check the file size (if it is not too big)
|
|
6300
|
-
// TODO: !!!!!!!! Delete the file
|
|
6311
|
+
// TODO: !!!!!!!! Delete the file after the scraping is done
|
|
6301
6312
|
return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
|
|
6302
6313
|
case 5:
|
|
6303
6314
|
if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];
|