@promptbook/cli 0.52.0-2 → 0.52.0-25
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 -6
- package/esm/index.es.js +40 -72
- package/esm/index.es.js.map +1 -1
- package/esm/typings/_packages/core.index.d.ts +16 -6
- package/esm/typings/_packages/utils.index.d.ts +3 -8
- package/esm/typings/execution/ExecutionTools.d.ts +5 -3
- package/esm/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/esm/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -0
- package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +35 -0
- package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +23 -0
- package/esm/typings/execution/plugins/llm-execution-tools/multiple/playground/playground.d.ts +2 -0
- package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +1 -1
- package/esm/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +4 -17
- package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +36 -4
- package/esm/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +2 -2
- package/esm/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
- package/esm/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +21 -5
- package/esm/typings/library/constructors/justTestFsImport.d.ts +7 -0
- package/esm/typings/types/Prompt.d.ts +1 -1
- package/esm/typings/types/typeAliases.d.ts +2 -2
- package/package.json +4 -4
- package/umd/index.umd.js +42 -73
- package/umd/index.umd.js.map +1 -1
- package/umd/typings/_packages/core.index.d.ts +16 -6
- package/umd/typings/_packages/utils.index.d.ts +3 -8
- package/umd/typings/execution/ExecutionTools.d.ts +5 -3
- package/umd/typings/execution/plugins/llm-execution-tools/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -0
- package/umd/typings/execution/plugins/llm-execution-tools/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -0
- package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts +35 -0
- package/umd/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionToolsOptions.d.ts +23 -0
- package/umd/typings/execution/plugins/llm-execution-tools/multiple/playground/playground.d.ts +2 -0
- package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptEvalExecutionTools.d.ts +1 -1
- package/umd/typings/execution/plugins/script-execution-tools/javascript/JavascriptExecutionTools.d.ts +4 -17
- package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.d.ts +36 -4
- package/umd/typings/library/constructors/createPromptbookLibraryFromDirectory.test.d.ts +1 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.d.ts +2 -2
- package/umd/typings/library/constructors/createPromptbookLibraryFromPromise.test.d.ts +1 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromSources.test.d.ts +1 -0
- package/umd/typings/library/constructors/createPromptbookLibraryFromUrl.d.ts +21 -5
- package/umd/typings/library/constructors/justTestFsImport.d.ts +7 -0
- package/umd/typings/types/Prompt.d.ts +1 -1
- package/umd/typings/types/typeAliases.d.ts +2 -2
- package/esm/typings/_packages/wizzard.index.d.ts +0 -5
- package/esm/typings/wizzard/Wizzard.d.ts +0 -4
- package/esm/typings/wizzard/sample.d.ts +0 -6
- package/umd/typings/_packages/wizzard.index.d.ts +0 -5
- package/umd/typings/wizzard/Wizzard.d.ts +0 -4
- package/umd/typings/wizzard/sample.d.ts +0 -6
package/esm/typings/execution/plugins/llm-execution-tools/multiple/MultipleLlmExecutionTools.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Prompt } from '../../../../types/Prompt';
|
|
2
|
+
import type { AvailableModel, LlmExecutionTools } from '../../../LlmExecutionTools';
|
|
3
|
+
import type { PromptChatResult, PromptCompletionResult } from '../../../PromptResult';
|
|
4
|
+
/**
|
|
5
|
+
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/webgptorg/promptbook#multiple-server
|
|
8
|
+
*/
|
|
9
|
+
export declare class MultipleLlmExecutionTools implements LlmExecutionTools {
|
|
10
|
+
/**
|
|
11
|
+
* Array of execution tools in order of priority
|
|
12
|
+
*/
|
|
13
|
+
private llmExecutionTools;
|
|
14
|
+
/**
|
|
15
|
+
* Gets array of execution tools in order of priority
|
|
16
|
+
*/
|
|
17
|
+
constructor(...llmExecutionTools: Array<LlmExecutionTools>);
|
|
18
|
+
/**
|
|
19
|
+
* Calls the best available chat model
|
|
20
|
+
*/
|
|
21
|
+
gptChat(prompt: Prompt): Promise<PromptChatResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Calls the best available completion model
|
|
24
|
+
*/
|
|
25
|
+
gptComplete(prompt: Prompt): Promise<PromptCompletionResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Calls the best available model
|
|
28
|
+
*/
|
|
29
|
+
private gptCommon;
|
|
30
|
+
/**
|
|
31
|
+
* List all available models that can be used
|
|
32
|
+
* This liost is a combination of all available models from all execution tools
|
|
33
|
+
*/
|
|
34
|
+
listModels(): Promise<Array<AvailableModel>>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { client_id, string_uri } from '../../../../types/typeAliases';
|
|
2
|
+
import type { CommonExecutionToolsOptions } from '../../../CommonExecutionToolsOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Options for MultipleLlmExecutionTools
|
|
5
|
+
*/
|
|
6
|
+
export type MultipleLlmExecutionToolsOptions = CommonExecutionToolsOptions & {
|
|
7
|
+
/**
|
|
8
|
+
* URL of the multiple PROMPTBOOK server
|
|
9
|
+
* On this server will be connected to the socket.io server
|
|
10
|
+
*/
|
|
11
|
+
readonly multipleUrl: URL;
|
|
12
|
+
/**
|
|
13
|
+
* Path for the Socket.io server to listen
|
|
14
|
+
*
|
|
15
|
+
* @default '/socket.io'
|
|
16
|
+
* @example '/promptbook/socket.io'
|
|
17
|
+
*/
|
|
18
|
+
readonly path: string_uri;
|
|
19
|
+
/**
|
|
20
|
+
* Your client ID
|
|
21
|
+
*/
|
|
22
|
+
readonly clientId: client_id;
|
|
23
|
+
};
|
|
@@ -8,7 +8,7 @@ import { JavascriptExecutionToolsOptions } from './JavascriptExecutionToolsOptio
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class JavascriptEvalExecutionTools implements ScriptExecutionTools {
|
|
10
10
|
private readonly options;
|
|
11
|
-
constructor(options
|
|
11
|
+
constructor(options?: JavascriptExecutionToolsOptions);
|
|
12
12
|
/**
|
|
13
13
|
* Executes a JavaScript
|
|
14
14
|
*/
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JavascriptExecutionToolsOptions } from './JavascriptExecutionToolsOptions';
|
|
1
|
+
import { JavascriptEvalExecutionTools } from './JavascriptEvalExecutionTools';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* Placeholder for better implementation of JavascriptExecutionTools - some propper sandboxing
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
export declare class JavascriptExecutionTools implements ScriptExecutionTools {
|
|
9
|
-
private readonly options;
|
|
10
|
-
constructor(options: JavascriptExecutionToolsOptions);
|
|
11
|
-
/**
|
|
12
|
-
* Executes a JavaScript
|
|
13
|
-
*/
|
|
14
|
-
execute(options: ScriptExecutionToolsExecuteOptions): Promise<string>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* TODO: !! Pass isVerbose to constructor and use it
|
|
18
|
-
* TODO: !! Probbably make some common util createStatementToEvaluate
|
|
19
|
-
* TODO: !! Implement via vm2
|
|
5
|
+
* @alias JavascriptExecutionTools
|
|
20
6
|
*/
|
|
7
|
+
export declare const JavascriptExecutionTools: typeof JavascriptEvalExecutionTools;
|
|
@@ -1,14 +1,46 @@
|
|
|
1
|
+
import { string_folder_path } from '../../types/typeAliases';
|
|
1
2
|
import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
3
|
+
/**
|
|
4
|
+
* Options for `createPromptbookLibraryFromDirectory` function
|
|
5
|
+
*/
|
|
6
|
+
type CreatePromptbookLibraryFromDirectoryOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* If true, the directory is searched recursively for promptbooks
|
|
9
|
+
*
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
isRecursive?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* If true, the library creation outputs information about each file it reads
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
isVerbose?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* If true, directory will be scanned only when needed not during the construction
|
|
21
|
+
*
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
isLazyLoaded?: boolean;
|
|
25
|
+
};
|
|
2
26
|
/**
|
|
3
27
|
* Constructs Promptbook from given directory
|
|
4
28
|
*
|
|
5
29
|
* Note: Works only in Node.js environment because it reads the file system
|
|
6
|
-
* Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
|
|
7
|
-
* SO during the construction syntax and logic sources IS NOT validated
|
|
8
30
|
*
|
|
31
|
+
* @param path - path to the directory with promptbooks
|
|
32
|
+
* @param options - Misc options for the library
|
|
9
33
|
* @returns PromptbookLibrary
|
|
10
34
|
*/
|
|
11
|
-
export declare function createPromptbookLibraryFromDirectory(): PromptbookLibrary
|
|
35
|
+
export declare function createPromptbookLibraryFromDirectory(path: string_folder_path, options?: CreatePromptbookLibraryFromDirectoryOptions): Promise<PromptbookLibrary>;
|
|
36
|
+
export {};
|
|
12
37
|
/***
|
|
13
|
-
* TODO: [
|
|
38
|
+
* TODO: [🧠] Maybe do not do hacks like [1] and just create package @promptbook/node
|
|
39
|
+
* [🍓][🚯] maybe make `@promptbook/library` package
|
|
40
|
+
* TODO: Fix the dynamic import issue in Webpack (! Not working !)
|
|
41
|
+
* > ./node_modules/@promptbook/core/esm/index.es.js
|
|
42
|
+
* > Critical dependency: the request of a dependency is an expression
|
|
43
|
+
*
|
|
44
|
+
* Note: [1] Using require(just('fs/promises')) to allow
|
|
45
|
+
* the `@promptbook/core` work for both Node.js and browser environments
|
|
14
46
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,11 +14,11 @@ import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
|
14
14
|
* Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
|
|
15
15
|
* when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
|
|
16
16
|
*
|
|
17
|
+
* Note: Consider using `createPromptbookLibraryFromDirectory` or `createPromptbookLibraryFromUrl`
|
|
17
18
|
*
|
|
18
19
|
* @param promptbookSourcesPromiseOrFactory
|
|
19
20
|
* @returns PromptbookLibrary
|
|
20
|
-
*
|
|
21
|
-
* @deprecated Consider using `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
|
|
21
|
+
* @private Just internal tool for other constructor functions
|
|
22
22
|
*/
|
|
23
23
|
export declare function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory: Promise<Array<PromptbookJson | PromptbookString>> | (() => Promise<Array<PromptbookJson | PromptbookString>>)): PromptbookLibrary;
|
|
24
24
|
/***
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
+
import { string_url } from '../../types/typeAliases';
|
|
1
2
|
import { PromptbookLibrary } from '../PromptbookLibrary';
|
|
3
|
+
/**
|
|
4
|
+
* Options for `createPromptbookLibraryFromDirectory` function
|
|
5
|
+
*/
|
|
6
|
+
type CreatePromptbookLibraryFromUrlyOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* If true, the library creation outputs information about each file it reads
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
isVerbose?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* If true, directory will be scanned only when needed not during the construction
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
isLazyLoaded?: boolean;
|
|
19
|
+
};
|
|
2
20
|
/**
|
|
3
21
|
* Constructs Promptbook from remote Promptbase URL
|
|
4
|
-
|
|
5
|
-
* Note: The function does NOT return promise it returns the library directly which dynamically loads promptbooks when needed
|
|
6
|
-
* SO during the construction syntax and logic sources IS NOT validated
|
|
7
|
-
*
|
|
22
|
+
|
|
8
23
|
* @returns PromptbookLibrary
|
|
9
24
|
*/
|
|
10
|
-
export declare function createPromptbookLibraryFromUrl(): PromptbookLibrary
|
|
25
|
+
export declare function createPromptbookLibraryFromUrl(url: string_url | URL, options: CreatePromptbookLibraryFromUrlyOptions): Promise<PromptbookLibrary>;
|
|
26
|
+
export {};
|
|
11
27
|
/***
|
|
12
28
|
* TODO: [🍓][🚯] !!! Add to README and samples + maybe make `@promptbook/library` package
|
|
13
29
|
*/
|
|
@@ -39,7 +39,7 @@ export type Prompt = {
|
|
|
39
39
|
/**
|
|
40
40
|
* Unique identifier of the promptbook with specific template name as hash
|
|
41
41
|
*
|
|
42
|
-
* @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md
|
|
42
|
+
* @example https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords
|
|
43
43
|
*/
|
|
44
44
|
readonly promptbookUrl: string_promptbook_url_with_hashtemplate;
|
|
45
45
|
/**
|
|
@@ -179,13 +179,13 @@ export type string_url = string;
|
|
|
179
179
|
/**
|
|
180
180
|
* Semantic helper
|
|
181
181
|
*
|
|
182
|
-
* For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md
|
|
182
|
+
* For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md"`
|
|
183
183
|
*/
|
|
184
184
|
export type string_promptbook_url = string;
|
|
185
185
|
/**
|
|
186
186
|
* Semantic helper
|
|
187
187
|
*
|
|
188
|
-
* For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md
|
|
188
|
+
* For example `"https://promptbook.webgpt.com/cs/write-website-content.ptbk.md#keywords"`
|
|
189
189
|
*/
|
|
190
190
|
export type string_promptbook_url_with_hashtemplate = string;
|
|
191
191
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/cli",
|
|
3
|
-
"version": "0.52.0-
|
|
3
|
+
"version": "0.52.0-25",
|
|
4
4
|
"description": "Library to supercharge your use of large language models",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"commander": "12.0.0",
|
|
39
39
|
"glob-promise": "6.0.5",
|
|
40
40
|
"prettier": "2.8.1",
|
|
41
|
-
"spacetrim": "0.11.
|
|
42
|
-
"waitasecond": "1.11.
|
|
41
|
+
"spacetrim": "0.11.27",
|
|
42
|
+
"waitasecond": "1.11.71"
|
|
43
43
|
},
|
|
44
44
|
"funding": [
|
|
45
45
|
{
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
],
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@promptbook/core": "0.52.0-
|
|
55
|
+
"@promptbook/core": "0.52.0-25"
|
|
56
56
|
},
|
|
57
57
|
"main": "./umd/index.umd.js",
|
|
58
58
|
"module": "./esm/index.es.js",
|
package/umd/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('commander'), require('fs/promises'), require('glob-promise'), require('spacetrim'), require('waitasecond'), require('prettier'), require('prettier/parser-html')
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'commander', 'fs/promises', 'glob-promise', 'spacetrim', 'waitasecond', 'prettier', 'prettier/parser-html'
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('commander'), require('fs/promises'), require('glob-promise'), require('spacetrim'), require('waitasecond'), require('prettier'), require('prettier/parser-html')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'colors', 'commander', 'fs/promises', 'glob-promise', 'spacetrim', 'waitasecond', 'prettier', 'prettier/parser-html'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-cli"] = {}, global.colors, global.commander, global.promises, global.glob, global.spacetrim, global.waitasecond, global.prettier, global.parserHtml));
|
|
5
5
|
})(this, (function (exports, colors, commander, promises, glob, spacetrim, waitasecond, prettier, parserHtml) { 'use strict';
|
|
6
6
|
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
/**
|
|
147
147
|
* The version of the Promptbook library
|
|
148
148
|
*/
|
|
149
|
-
var PROMPTBOOK_VERSION = '0.52.0-
|
|
149
|
+
var PROMPTBOOK_VERSION = '0.52.0-24';
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
152
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -755,34 +755,19 @@
|
|
|
755
755
|
})(Error));
|
|
756
756
|
|
|
757
757
|
/**
|
|
758
|
-
* This error
|
|
759
|
-
*/
|
|
760
|
-
/** @class */ ((function (_super) {
|
|
761
|
-
__extends(PromptbookExecutionError, _super);
|
|
762
|
-
function PromptbookExecutionError(message) {
|
|
763
|
-
var _this = _super.call(this, message) || this;
|
|
764
|
-
_this.name = 'PromptbookExecutionError';
|
|
765
|
-
Object.setPrototypeOf(_this, PromptbookExecutionError.prototype);
|
|
766
|
-
return _this;
|
|
767
|
-
}
|
|
768
|
-
return PromptbookExecutionError;
|
|
769
|
-
})(Error));
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
758
|
+
* This error occurs during the parameter replacement in the template
|
|
773
759
|
*
|
|
774
|
-
*
|
|
775
|
-
* Note: This is a kindof subtype of PromptbookExecutionError
|
|
760
|
+
* Note: This is a kindof subtype of PromptbookExecutionError because it occurs during the execution of the pipeline
|
|
776
761
|
*/
|
|
777
762
|
/** @class */ ((function (_super) {
|
|
778
|
-
__extends(
|
|
779
|
-
function
|
|
763
|
+
__extends(TemplateError, _super);
|
|
764
|
+
function TemplateError(message) {
|
|
780
765
|
var _this = _super.call(this, message) || this;
|
|
781
|
-
_this.name = '
|
|
782
|
-
Object.setPrototypeOf(_this,
|
|
766
|
+
_this.name = 'TemplateError';
|
|
767
|
+
Object.setPrototypeOf(_this, TemplateError.prototype);
|
|
783
768
|
return _this;
|
|
784
769
|
}
|
|
785
|
-
return
|
|
770
|
+
return TemplateError;
|
|
786
771
|
})(Error));
|
|
787
772
|
|
|
788
773
|
var defaultDiacriticsRemovalMap = [
|
|
@@ -1037,54 +1022,6 @@
|
|
|
1037
1022
|
});
|
|
1038
1023
|
}
|
|
1039
1024
|
|
|
1040
|
-
/**
|
|
1041
|
-
* This error occurs during the parameter replacement in the template
|
|
1042
|
-
*
|
|
1043
|
-
* Note: This is a kindof subtype of PromptbookExecutionError because it occurs during the execution of the pipeline
|
|
1044
|
-
*/
|
|
1045
|
-
/** @class */ ((function (_super) {
|
|
1046
|
-
__extends(TemplateError, _super);
|
|
1047
|
-
function TemplateError(message) {
|
|
1048
|
-
var _this = _super.call(this, message) || this;
|
|
1049
|
-
_this.name = 'TemplateError';
|
|
1050
|
-
Object.setPrototypeOf(_this, TemplateError.prototype);
|
|
1051
|
-
return _this;
|
|
1052
|
-
}
|
|
1053
|
-
return TemplateError;
|
|
1054
|
-
})(Error));
|
|
1055
|
-
|
|
1056
|
-
/**
|
|
1057
|
-
* Prettify the html code
|
|
1058
|
-
*
|
|
1059
|
-
* @param content raw html code
|
|
1060
|
-
* @returns formatted html code
|
|
1061
|
-
*/
|
|
1062
|
-
function prettifyMarkdown(content) {
|
|
1063
|
-
try {
|
|
1064
|
-
return prettier.format(content, {
|
|
1065
|
-
parser: 'markdown',
|
|
1066
|
-
plugins: [parserHtml__default["default"]],
|
|
1067
|
-
// TODO: DRY - make some import or auto-copy of .prettierrc
|
|
1068
|
-
endOfLine: 'lf',
|
|
1069
|
-
tabWidth: 4,
|
|
1070
|
-
singleQuote: true,
|
|
1071
|
-
trailingComma: 'all',
|
|
1072
|
-
arrowParens: 'always',
|
|
1073
|
-
printWidth: 120,
|
|
1074
|
-
htmlWhitespaceSensitivity: 'ignore',
|
|
1075
|
-
jsxBracketSameLine: false,
|
|
1076
|
-
bracketSpacing: true,
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
catch (error) {
|
|
1080
|
-
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
1081
|
-
error: error,
|
|
1082
|
-
html: content,
|
|
1083
|
-
});
|
|
1084
|
-
return content;
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
1025
|
/**
|
|
1089
1026
|
* Removes Markdown formatting tags from a string.
|
|
1090
1027
|
*
|
|
@@ -1814,6 +1751,38 @@
|
|
|
1814
1751
|
return content.replace(heading, "<!--".concat(sectionName, "-->\n").concat(warningLine, "\n").concat(sectionContent, "\n<!--/").concat(sectionName, "-->\n\n").concat(heading));
|
|
1815
1752
|
}
|
|
1816
1753
|
|
|
1754
|
+
/**
|
|
1755
|
+
* Prettify the html code
|
|
1756
|
+
*
|
|
1757
|
+
* @param content raw html code
|
|
1758
|
+
* @returns formatted html code
|
|
1759
|
+
*/
|
|
1760
|
+
function prettifyMarkdown(content) {
|
|
1761
|
+
try {
|
|
1762
|
+
return prettier.format(content, {
|
|
1763
|
+
parser: 'markdown',
|
|
1764
|
+
plugins: [parserHtml__default["default"]],
|
|
1765
|
+
// TODO: DRY - make some import or auto-copy of .prettierrc
|
|
1766
|
+
endOfLine: 'lf',
|
|
1767
|
+
tabWidth: 4,
|
|
1768
|
+
singleQuote: true,
|
|
1769
|
+
trailingComma: 'all',
|
|
1770
|
+
arrowParens: 'always',
|
|
1771
|
+
printWidth: 120,
|
|
1772
|
+
htmlWhitespaceSensitivity: 'ignore',
|
|
1773
|
+
jsxBracketSameLine: false,
|
|
1774
|
+
bracketSpacing: true,
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1777
|
+
catch (error) {
|
|
1778
|
+
console.error('There was an error with prettifying the markdown, using the original as the fallback', {
|
|
1779
|
+
error: error,
|
|
1780
|
+
html: content,
|
|
1781
|
+
});
|
|
1782
|
+
return content;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1817
1786
|
/**
|
|
1818
1787
|
* Prettyfies Promptbook string and adds Mermaid graph
|
|
1819
1788
|
*/
|