@promptbook/remote-server 0.84.0-16 โ 0.84.0-17
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 +7 -1
- package/esm/index.es.js +22 -15
- 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 +6 -4
- package/umd/index.umd.js +22 -15
- package/umd/index.umd.js.map +1 -1
- package/LICENSE.md +0 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
## ๐ New Features
|
|
18
18
|
|
|
19
|
-
- ๐ **Support of [DeepSeek models](https://www.
|
|
19
|
+
- ๐ **Support of [DeepSeek models](https://www.npmjs.com/package/@promptbook/deepseek)**
|
|
20
20
|
- ๐ Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
|
|
21
21
|
- ๐ค Run books from CLI - `npx ptbk run path/to/your/book`
|
|
22
22
|
- ๐ Support of `.docx`, `.doc` and `.pdf` documents as knowledge
|
|
@@ -435,6 +435,12 @@ See [TODO.md](./TODO.md)
|
|
|
435
435
|
|
|
436
436
|
|
|
437
437
|
|
|
438
|
+
|
|
439
|
+
## ๐ค Partners
|
|
440
|
+
|
|
441
|
+
[](https://technologickainkubace.org/en/about-technology-incubation/about-the-project/)
|
|
442
|
+
|
|
443
|
+
|
|
438
444
|
## ๐๏ธ Contributing
|
|
439
445
|
|
|
440
446
|
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
|
@@ -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-16';
|
|
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
|
|
@@ -199,6 +199,12 @@ var ADMIN_GITHUB_NAME = 'hejny';
|
|
|
199
199
|
* @public exported from `@promptbook/core`
|
|
200
200
|
*/
|
|
201
201
|
var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
|
|
202
|
+
/**
|
|
203
|
+
* Maximum file size limit
|
|
204
|
+
*
|
|
205
|
+
* @public exported from `@promptbook/core`
|
|
206
|
+
*/
|
|
207
|
+
var DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
202
208
|
// <- TODO: [๐ง ] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
203
209
|
/**
|
|
204
210
|
* The maximum number of iterations for a loops
|
|
@@ -6232,11 +6238,10 @@ var scraperFetch = function (url, init) { return __awaiter(void 0, void 0, void
|
|
|
6232
6238
|
function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
6233
6239
|
var _a;
|
|
6234
6240
|
return __awaiter(this, void 0, void 0, function () {
|
|
6235
|
-
var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, _f, _g,
|
|
6236
|
-
return __generator(this, function (
|
|
6237
|
-
switch (
|
|
6241
|
+
var _b, fetch, knowledgeSourceContent, name, _c, _d, rootDirname, url, response_1, mimeType, basename, hash, rootDirname_1, filepath, fileContent, _f, _g, filename_1, fileExtension, mimeType;
|
|
6242
|
+
return __generator(this, function (_h) {
|
|
6243
|
+
switch (_h.label) {
|
|
6238
6244
|
case 0:
|
|
6239
|
-
console.log('!!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
6240
6245
|
_b = tools.fetch, fetch = _b === void 0 ? scraperFetch : _b;
|
|
6241
6246
|
knowledgeSourceContent = knowledgeSource.knowledgeSourceContent;
|
|
6242
6247
|
name = knowledgeSource.name;
|
|
@@ -6248,7 +6253,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
6248
6253
|
url = knowledgeSourceContent;
|
|
6249
6254
|
return [4 /*yield*/, fetch(url)];
|
|
6250
6255
|
case 1:
|
|
6251
|
-
response_1 =
|
|
6256
|
+
response_1 = _h.sent();
|
|
6252
6257
|
mimeType = ((_a = response_1.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.split(';')[0]) || 'text/html';
|
|
6253
6258
|
if (tools.fs === undefined || !url.endsWith('.pdf' /* <- TODO: [๐ต] */)) {
|
|
6254
6259
|
return [2 /*return*/, {
|
|
@@ -6298,17 +6303,19 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
6298
6303
|
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));
|
|
6299
6304
|
return [4 /*yield*/, tools.fs.mkdir(dirname(join(rootDirname_1, filepath)), { recursive: true })];
|
|
6300
6305
|
case 2:
|
|
6301
|
-
|
|
6302
|
-
_g = (_f =
|
|
6303
|
-
_h = [join(rootDirname_1, filepath)];
|
|
6304
|
-
_k = (_j = Buffer).from;
|
|
6306
|
+
_h.sent();
|
|
6307
|
+
_g = (_f = Buffer).from;
|
|
6305
6308
|
return [4 /*yield*/, response_1.arrayBuffer()];
|
|
6306
|
-
case 3:
|
|
6309
|
+
case 3:
|
|
6310
|
+
fileContent = _g.apply(_f, [_h.sent()]);
|
|
6311
|
+
if (fileContent.length > DEFAULT_MAX_FILE_SIZE /* <- TODO: Allow to pass different value to remote server */) {
|
|
6312
|
+
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."));
|
|
6313
|
+
}
|
|
6314
|
+
return [4 /*yield*/, tools.fs.writeFile(join(rootDirname_1, filepath), fileContent)];
|
|
6307
6315
|
case 4:
|
|
6308
|
-
|
|
6316
|
+
_h.sent();
|
|
6309
6317
|
// TODO: [๐ต] Check the file security
|
|
6310
|
-
// TODO:
|
|
6311
|
-
// TODO: !!!!!!!! Delete the file after the scraping is done
|
|
6318
|
+
// TODO: [๐งน][๐ง ] Delete the file after the scraping is done
|
|
6312
6319
|
return [2 /*return*/, makeKnowledgeSourceHandler({ name: name, knowledgeSourceContent: filepath }, tools, __assign(__assign({}, options), { rootDirname: rootDirname_1 }))];
|
|
6313
6320
|
case 5:
|
|
6314
6321
|
if (!isValidFilePath(knowledgeSourceContent)) return [3 /*break*/, 7];
|
|
@@ -6325,7 +6332,7 @@ function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
6325
6332
|
mimeType = extensionToMimeType(fileExtension || '');
|
|
6326
6333
|
return [4 /*yield*/, isFileExisting(filename_1, tools.fs)];
|
|
6327
6334
|
case 6:
|
|
6328
|
-
if (!(
|
|
6335
|
+
if (!(_h.sent())) {
|
|
6329
6336
|
throw new NotFoundError(spaceTrim$1(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 "); }));
|
|
6330
6337
|
}
|
|
6331
6338
|
// TODO: [๐ง ][๐ฟ] Test security file - file is scoped to the project (BUT maybe do this in `filesystemTools`)
|