@promptbook/website-crawler 0.72.0-28 → 0.72.0-29
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/esm/index.es.js +42 -20
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +4 -0
- package/esm/typings/src/scrapers/website/utils/createShowdownConverter.d.ts +7 -0
- package/package.json +2 -2
- package/umd/index.umd.js +42 -20
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -15,7 +15,7 @@ import { unparse, parse } from 'papaparse';
|
|
|
15
15
|
/**
|
|
16
16
|
* The version of the Promptbook library
|
|
17
17
|
*/
|
|
18
|
-
var PROMPTBOOK_VERSION = '0.72.0-
|
|
18
|
+
var PROMPTBOOK_VERSION = '0.72.0-28';
|
|
19
19
|
// TODO: [main] !!!! List here all the versions and annotate + put into script
|
|
20
20
|
|
|
21
21
|
/*! *****************************************************************************
|
|
@@ -632,22 +632,6 @@ var websiteScraperMetadata = $deepFreeze({
|
|
|
632
632
|
*/
|
|
633
633
|
$scrapersMetadataRegister.register(websiteScraperMetadata);
|
|
634
634
|
|
|
635
|
-
/**
|
|
636
|
-
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
637
|
-
*
|
|
638
|
-
* @public exported from `@promptbook/core`
|
|
639
|
-
*/
|
|
640
|
-
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
641
|
-
__extends(KnowledgeScrapeError, _super);
|
|
642
|
-
function KnowledgeScrapeError(message) {
|
|
643
|
-
var _this = _super.call(this, message) || this;
|
|
644
|
-
_this.name = 'KnowledgeScrapeError';
|
|
645
|
-
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
646
|
-
return _this;
|
|
647
|
-
}
|
|
648
|
-
return KnowledgeScrapeError;
|
|
649
|
-
}(Error));
|
|
650
|
-
|
|
651
635
|
/**
|
|
652
636
|
* Just marks a place of place where should be something implemented
|
|
653
637
|
* No side effects.
|
|
@@ -2838,6 +2822,22 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
2838
2822
|
* TODO: [🏢] !! Check validity of `temperature` in pipeline
|
|
2839
2823
|
*/
|
|
2840
2824
|
|
|
2825
|
+
/**
|
|
2826
|
+
* This error indicates that the promptbook can not retrieve knowledge from external sources
|
|
2827
|
+
*
|
|
2828
|
+
* @public exported from `@promptbook/core`
|
|
2829
|
+
*/
|
|
2830
|
+
var KnowledgeScrapeError = /** @class */ (function (_super) {
|
|
2831
|
+
__extends(KnowledgeScrapeError, _super);
|
|
2832
|
+
function KnowledgeScrapeError(message) {
|
|
2833
|
+
var _this = _super.call(this, message) || this;
|
|
2834
|
+
_this.name = 'KnowledgeScrapeError';
|
|
2835
|
+
Object.setPrototypeOf(_this, KnowledgeScrapeError.prototype);
|
|
2836
|
+
return _this;
|
|
2837
|
+
}
|
|
2838
|
+
return KnowledgeScrapeError;
|
|
2839
|
+
}(Error));
|
|
2840
|
+
|
|
2841
2841
|
/**
|
|
2842
2842
|
* @@@
|
|
2843
2843
|
*
|
|
@@ -5695,6 +5695,28 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
5695
5695
|
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
5696
5696
|
*/
|
|
5697
5697
|
|
|
5698
|
+
/**
|
|
5699
|
+
* Create a new showdown converter instance
|
|
5700
|
+
*
|
|
5701
|
+
* @private utility of `WebsiteScraper`
|
|
5702
|
+
*/
|
|
5703
|
+
function createShowdownConverter() {
|
|
5704
|
+
return new Converter({
|
|
5705
|
+
flavor: 'github',
|
|
5706
|
+
/*
|
|
5707
|
+
> import showdownHighlight from 'showdown-highlight';
|
|
5708
|
+
> extensions: [
|
|
5709
|
+
> showdownHighlight({
|
|
5710
|
+
> // Whether to add the classes to the <pre> tag, default is false
|
|
5711
|
+
> pre: true,
|
|
5712
|
+
> // Whether to use hljs' auto language detection, default is true
|
|
5713
|
+
> auto_detection: true,
|
|
5714
|
+
> }),
|
|
5715
|
+
> ],
|
|
5716
|
+
*/
|
|
5717
|
+
});
|
|
5718
|
+
}
|
|
5719
|
+
|
|
5698
5720
|
/**
|
|
5699
5721
|
* Scraper for websites
|
|
5700
5722
|
*
|
|
@@ -5706,9 +5728,12 @@ var WebsiteScraper = /** @class */ (function () {
|
|
|
5706
5728
|
this.tools = tools;
|
|
5707
5729
|
this.options = options;
|
|
5708
5730
|
this.markdownScraper = new MarkdownScraper(tools, options);
|
|
5731
|
+
// TODO: !!!!!! Remove
|
|
5709
5732
|
TODO_USE(Readability);
|
|
5710
5733
|
TODO_USE(Converter);
|
|
5711
5734
|
TODO_USE(JSDOM);
|
|
5735
|
+
TODO_USE(createShowdownConverter);
|
|
5736
|
+
this.showdownConverter = createShowdownConverter();
|
|
5712
5737
|
}
|
|
5713
5738
|
Object.defineProperty(WebsiteScraper.prototype, "metadata", {
|
|
5714
5739
|
/**
|
|
@@ -5729,9 +5754,6 @@ var WebsiteScraper = /** @class */ (function () {
|
|
|
5729
5754
|
return __awaiter(this, void 0, void 0, function () {
|
|
5730
5755
|
var markdown;
|
|
5731
5756
|
return __generator(this, function (_a) {
|
|
5732
|
-
if (source.url === null) {
|
|
5733
|
-
throw new KnowledgeScrapeError('Website scraper requires URL');
|
|
5734
|
-
}
|
|
5735
5757
|
markdown = "";
|
|
5736
5758
|
return [2 /*return*/, __assign(__assign({}, source), { markdown: markdown, destroy: function () { } })];
|
|
5737
5759
|
});
|