@promptbook/pdf 0.84.0-16 โ 0.84.0-18
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/README.md +6 -1
- package/esm/index.es.js +27 -20
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/config.d.ts +6 -0
- package/esm/typings/src/conversion/compilePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/prepare/preparePipelineOnRemoteServer.d.ts +1 -1
- package/esm/typings/src/remote-server/socket-types/_subtypes/PromptbookServer_Identification.d.ts +5 -2
- package/package.json +9 -4
- package/umd/index.umd.js +27 -20
- package/umd/index.umd.js.map +1 -1
- package/LICENSE.md +0 -1
package/README.md
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
## ๐ New Features
|
|
18
18
|
|
|
19
|
-
-
|
|
19
|
+
- ๐ซ Support of [`o3-mini` model by OpenAI](https://openai.com/index/openai-o3-mini/)
|
|
20
|
+
- ๐ **Support of [DeepSeek models](https://www.npmjs.com/package/@promptbook/deepseek)**
|
|
20
21
|
- ๐ Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
|
|
21
22
|
- ๐ค Run books from CLI - `npx ptbk run path/to/your/book`
|
|
22
23
|
- ๐ Support of `.docx`, `.doc` and `.pdf` documents as knowledge
|
|
@@ -437,6 +438,10 @@ See [TODO.md](./TODO.md)
|
|
|
437
438
|
|
|
438
439
|
|
|
439
440
|
|
|
441
|
+
## ๐ค Partners
|
|
442
|
+
|
|
443
|
+
[](https://technologickainkubace.org/en/about-technology-incubation/about-the-project/)
|
|
444
|
+
|
|
440
445
|
## ๐๏ธ Contributing
|
|
441
446
|
|
|
442
447
|
I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [โ buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).
|
package/esm/index.es.js
CHANGED
|
@@ -24,7 +24,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-
|
|
27
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-17';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
@@ -195,6 +195,12 @@ var ADMIN_GITHUB_NAME = 'hejny';
|
|
|
195
195
|
* @public exported from `@promptbook/core`
|
|
196
196
|
*/
|
|
197
197
|
var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
|
|
198
|
+
/**
|
|
199
|
+
* Maximum file size limit
|
|
200
|
+
*
|
|
201
|
+
* @public exported from `@promptbook/core`
|
|
202
|
+
*/
|
|
203
|
+
var DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
198
204
|
// <- TODO: [๐ง ] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
199
205
|
/**
|
|
200
206
|
* The maximum number of iterations for a loops
|
|
@@ -3626,11 +3632,10 @@ var scraperFetch = function (url, init) { return __awaiter(void 0, void 0, void
|
|
|
3626
3632
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
3627
3633
|
var _a;
|
|
3628
3634
|
return __awaiter(this, void 0, void 0, function () {
|
|
3629
|
-
var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, _f, _g,
|
|
3630
|
-
return __generator(this, function (
|
|
3631
|
-
switch (
|
|
3635
|
+
var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, fileContent, _f, _g, filename_1, fileExtension, mimeType;
|
|
3636
|
+
return __generator(this, function (_h) {
|
|
3637
|
+
switch (_h.label) {
|
|
3632
3638
|
case 0:
|
|
3633
|
-
console.log('!!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
3634
3639
|
_b = tools.fetch, fetch = _b === void 0 ? scraperFetch : _b;
|
|
3635
3640
|
knowledgeSourceContent = knowledgeSource.knowledgeSourceContent;
|
|
3636
3641
|
name = knowledgeSource.name;
|
|
@@ -3642,7 +3647,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3642
3647
|
url = knowledgeSourceContent;
|
|
3643
3648
|
return [4 /*yield*/, fetch(url)];
|
|
3644
3649
|
case 1:
|
|
3645
|
-
response_1 =
|
|
3650
|
+
response_1 = _h.sent();
|
|
3646
3651
|
mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
|
|
3647
3652
|
if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [๐ต] */)) {
|
|
3648
3653
|
return [2 /*return*/, {
|
|
@@ -3692,17 +3697,19 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3692
3697
|
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));
|
|
3693
3698
|
return [4 /*yield*/, tools.fs.mkdir(dirname(join(rootDirname_1, filepath)), { recursive: true })];
|
|
3694
3699
|
case 2:
|
|
3695
|
-
|
|
3696
|
-
_g = (_f =
|
|
3697
|
-
_h = [join(rootDirname_1, filepath)];
|
|
3698
|
-
_k = (_j = Buffer).from;
|
|
3700
|
+
_h.sent();
|
|
3701
|
+
_g = (_f = Buffer).from;
|
|
3699
3702
|
return [4 /*yield*/, response_1.arrayBuffer()];
|
|
3700
|
-
case 3:
|
|
3703
|
+
case 3:
|
|
3704
|
+
fileContent = _g.apply(_f, [_h.sent()]);
|
|
3705
|
+
if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
|
|
3706
|
+
throw new LimitReachedError("File is too large (".concat(Math.round(fileContent.length / 1024 / 1024), "MB). Maximum allowed size is ").concat(Math.round(DEFAULT_MAX_FILE_SIZE / 1024 / 1024), "MB."));
|
|
3707
|
+
}
|
|
3708
|
+
return [4 /*yield*/, tools.fs.writeFile(join(rootDirname_1, filepath), fileContent)];
|
|
3701
3709
|
case 4:
|
|
3702
|
-
|
|
3710
|
+
_h.sent();
|
|
3703
3711
|
// TODO: [๐ต] Check the file security
|
|
3704
|
-
// TODO:
|
|
3705
|
-
// TODO: !!!!!!!! Delete the file after the scraping is done
|
|
3712
|
+
// TODO: [๐งน][๐ง ] Delete the file after the scraping is done
|
|
3706
3713
|
return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
|
|
3707
3714
|
case 5:
|
|
3708
3715
|
if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];
|
|
@@ -3719,7 +3726,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
3719
3726
|
mimeType = extensionToMimeType(fileExtension || '');
|
|
3720
3727
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
3721
3728
|
case 6:
|
|
3722
|
-
if (!(
|
|
3729
|
+
if (!(_h.sent())) {
|
|
3723
3730
|
throw new NotFoundError(spaceTrim(function (block) { return "\n Can not make source handler for file which does not exist:\n\n File:\n ".concat(block(knowledgeSourceContent), "\n\n Full file path:\n ").concat(block(filename_1), "\n "); }));
|
|
3724
3731
|
}
|
|
3725
3732
|
// TODO: [๐ง ][๐ฟ] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|
|
@@ -6360,7 +6367,7 @@ var MarkitdownScraper = /** @class */ (function () {
|
|
|
6360
6367
|
// Note: Module `markitdown-ts` has no types available, so it is imported using `require`
|
|
6361
6368
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
6362
6369
|
var MarkItDown = require('markitdown-ts').MarkItDown;
|
|
6363
|
-
// <- TODO:
|
|
6370
|
+
// <- TODO: [๐] Use Markitdown directly not through this package
|
|
6364
6371
|
this.markitdown = new MarkItDown();
|
|
6365
6372
|
}
|
|
6366
6373
|
Object.defineProperty(MarkitdownScraper.prototype, "metadata", {
|
|
@@ -6405,7 +6412,7 @@ var MarkitdownScraper = /** @class */ (function () {
|
|
|
6405
6412
|
case 2:
|
|
6406
6413
|
if (!!(_f.sent())) return [3 /*break*/, 5];
|
|
6407
6414
|
src = source.filename || source.url || null;
|
|
6408
|
-
// console.log('
|
|
6415
|
+
// console.log('!!', { src, source, cacheFilehandler });
|
|
6409
6416
|
if (src === null) {
|
|
6410
6417
|
throw new UnexpectedError('Source has no filename or url');
|
|
6411
6418
|
}
|
|
@@ -6418,12 +6425,12 @@ var MarkitdownScraper = /** @class */ (function () {
|
|
|
6418
6425
|
result = _f.sent();
|
|
6419
6426
|
if (result === null || result === undefined) {
|
|
6420
6427
|
throw new Error("Markitdown could not convert the \"".concat(source.source, "\""));
|
|
6421
|
-
// <- TODO:
|
|
6428
|
+
// <- TODO: [๐] Make MarkitdownError
|
|
6422
6429
|
}
|
|
6423
|
-
// console.log('
|
|
6430
|
+
// console.log('!!', { result, cacheFilehandler });
|
|
6424
6431
|
return [4 /*yield*/, this.tools.fs.writeFile(cacheFilehandler.filename, result.text_content)];
|
|
6425
6432
|
case 4:
|
|
6426
|
-
// console.log('
|
|
6433
|
+
// console.log('!!', { result, cacheFilehandler });
|
|
6427
6434
|
_f.sent();
|
|
6428
6435
|
_f.label = 5;
|
|
6429
6436
|
case 5: return [2 /*return*/, cacheFilehandler];
|