@promptbook/fake-llm 0.100.0-44 → 0.100.0-46
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 +41 -42
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +14 -0
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +26 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource.d.ts +19 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +15 -0
- package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +128 -0
- package/esm/typings/src/book-components/Chat/interfaces/ChatMessage.d.ts +16 -0
- package/esm/typings/src/book-components/Chat/interfaces/ChatParticipant.d.ts +12 -0
- package/esm/typings/src/book-components/Chat/utils/ExportFormat.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/utils/addUtmParamsToUrl.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/utils/createShortLinkForChat.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/utils/downloadFile.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +11 -0
- package/esm/typings/src/book-components/Chat/utils/generatePdfContent.d.ts +10 -0
- package/esm/typings/src/book-components/Chat/utils/generateQrDataUrl.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/utils/getPromptbookBranding.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/utils/messagesToHtml.d.ts +10 -0
- package/esm/typings/src/book-components/Chat/utils/messagesToJson.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/utils/messagesToMarkdown.d.ts +10 -0
- package/esm/typings/src/book-components/Chat/utils/messagesToText.d.ts +10 -0
- package/esm/typings/src/config.d.ts +13 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +12 -13
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -0
- package/esm/typings/src/playground/permanent/error-handling-playground.d.ts +5 -0
- package/esm/typings/src/utils/organization/preserve.d.ts +21 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -5
- package/umd/index.umd.js +45 -45
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +0 -14
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { Promisable } from 'type-fest';
|
|
3
|
+
import type { ChatMessage } from '../interfaces/ChatMessage';
|
|
4
|
+
import type { ChatParticipant } from '../interfaces/ChatParticipant';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use `isComplete` instead
|
|
7
|
+
* @private util of `<Chat />`
|
|
8
|
+
*/
|
|
9
|
+
export declare const LOADING_INTERACTIVE_IMAGE = "Loading...";
|
|
10
|
+
interface ChatProps {
|
|
11
|
+
/**
|
|
12
|
+
* Optional callback to create a new agent from the template.
|
|
13
|
+
* If provided, renders the [Use this template] button.
|
|
14
|
+
*/
|
|
15
|
+
onUseTemplate?(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Messages to render - they are rendered as they are
|
|
18
|
+
*/
|
|
19
|
+
readonly messages: ReadonlyArray<ChatMessage>;
|
|
20
|
+
/**
|
|
21
|
+
* Called every time the user types or dictated a message
|
|
22
|
+
*/
|
|
23
|
+
onChange?(messageContent: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Called when user sends a message
|
|
26
|
+
*
|
|
27
|
+
* Note: You must handle the message yourself and add it to the `messages` array
|
|
28
|
+
*/
|
|
29
|
+
onMessage(messageContent: string): Promisable<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Optional callback, when set, button for resetting chat will be shown
|
|
32
|
+
*/
|
|
33
|
+
onReset?(): Promisable<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Determines whether the voice recognition button is rendered
|
|
36
|
+
*/
|
|
37
|
+
readonly isVoiceRecognitionButtonShown?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The language code to use for voice recognition
|
|
40
|
+
*/
|
|
41
|
+
readonly voiceLanguage?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Optional placeholder message for the textarea
|
|
44
|
+
*
|
|
45
|
+
* @default "Write a message"
|
|
46
|
+
*/
|
|
47
|
+
readonly placeholderMessageContent?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Optional preset message in chat
|
|
50
|
+
*/
|
|
51
|
+
readonly defaultMessage?: string;
|
|
52
|
+
/**
|
|
53
|
+
* List of tasks that are currently in progress that should be displayed
|
|
54
|
+
*/
|
|
55
|
+
readonly tasksProgress?: Array<{
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
progress?: number;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Content to be shown inside the chat bar in head
|
|
62
|
+
* If not provided, the chat bar will not be rendered
|
|
63
|
+
*/
|
|
64
|
+
readonly children?: ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Optional CSS class name which will be added to root <div/> element
|
|
67
|
+
*/
|
|
68
|
+
readonly className?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Optional CSS style which will be added to root <div/> element
|
|
71
|
+
*/
|
|
72
|
+
readonly style?: CSSProperties;
|
|
73
|
+
/**
|
|
74
|
+
* Voice call props - when provided, voice call button will be shown
|
|
75
|
+
*/
|
|
76
|
+
readonly voiceCallProps?: {
|
|
77
|
+
selectedModel: string;
|
|
78
|
+
providerClients: Map<string, unknown>;
|
|
79
|
+
currentPersonaContent?: string;
|
|
80
|
+
onVoiceMessage?: (content: string, isVoiceCall: boolean) => void;
|
|
81
|
+
onAssistantVoiceResponse?: (content: string, isVoiceCall: boolean) => void;
|
|
82
|
+
onVoiceCallStateChange?: (isVoiceCalling: boolean) => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Indicates whether a voice call is currently active
|
|
86
|
+
*/
|
|
87
|
+
readonly isVoiceCalling?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Whether experimental features are enabled (required for voice calling)
|
|
90
|
+
*/
|
|
91
|
+
readonly isExperimental?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the save button is enabled and shown
|
|
94
|
+
*/
|
|
95
|
+
readonly isSaveButtonEnabled?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Optional markdown header to include at the top of exported files.
|
|
98
|
+
* Example: "## Discussion Topic\n\nSome topic here"
|
|
99
|
+
*/
|
|
100
|
+
readonly exportHeaderMarkdown?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Optional mapping of participant IDs (message.from) to display metadata for exports.
|
|
103
|
+
* Keys should match ChatMessage.from values (e.g., 'USER', 'AGENT_{id}', etc.)
|
|
104
|
+
*/
|
|
105
|
+
readonly participants?: ReadonlyArray<ChatParticipant>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Renders a chat with messages and input for new messages
|
|
109
|
+
*
|
|
110
|
+
* Note: 🔇 This component does NOT have speak functionality, it just allows to trigger voice recognition
|
|
111
|
+
*
|
|
112
|
+
* Note: There are multiple chat components:
|
|
113
|
+
* - <Chat/> renders chat as it is without any logic
|
|
114
|
+
* - <SimpleChat/> with callback function after each message 🔵->🟢->🔵->🟢->🔵->🟢->...
|
|
115
|
+
* - <WorkerChat/> with continuously running worker function on background which binds on dialogues queue 🔵->🟢->🔵->🟢->🔵->🟢->...
|
|
116
|
+
* - <SignalChat/> fully controlled by signal that is passed in 🔵->🟢->🟢->🟢->🔵->🟢->...
|
|
117
|
+
* - <LlmChat/> connected to LLM Execution Tools of Promptbook
|
|
118
|
+
* - <AgentChat/> direct OpenAI API integration with streaming responses and model selection
|
|
119
|
+
* - <ChatbotMiniapp/> Fully working chatbot miniapp created from book
|
|
120
|
+
* - <AssistantChatPage/> page for assistant chat with welcome message and avatar
|
|
121
|
+
* - <ModelAwareChat/> wrapper around <Chat/> that provides model-aware avatars
|
|
122
|
+
*
|
|
123
|
+
* Use <WorkerChat/> or <SignalChat/> in most cases.
|
|
124
|
+
*
|
|
125
|
+
* @public exported from `@promptbook/components`
|
|
126
|
+
*/
|
|
127
|
+
export declare function Chat(props: ChatProps): import("react/jsx-runtime").JSX.Element;
|
|
128
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { string_markdown } from '../../../types/typeAliases';
|
|
2
|
+
import type { string_name } from '../../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* A message in the chat
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/components`
|
|
7
|
+
*/
|
|
8
|
+
export type ChatMessage = {
|
|
9
|
+
id: string;
|
|
10
|
+
date: Date;
|
|
11
|
+
from: string_name;
|
|
12
|
+
content: string_markdown;
|
|
13
|
+
isComplete?: boolean;
|
|
14
|
+
expectedAnswer?: string;
|
|
15
|
+
isVoiceCall?: boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { string_name } from '../../../types/typeAliases';
|
|
2
|
+
import type { string_url_image } from '../../../types/typeAliases';
|
|
3
|
+
/**
|
|
4
|
+
* A participant in the chat
|
|
5
|
+
*
|
|
6
|
+
* @public exported from `@promptbook/components`
|
|
7
|
+
*/
|
|
8
|
+
export type ChatParticipant = {
|
|
9
|
+
name: string_name;
|
|
10
|
+
avatarUrl?: string_url_image;
|
|
11
|
+
color: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ChatMessage } from '../interfaces/ChatMessage';
|
|
2
|
+
import type { ExportFormat } from './ExportFormat';
|
|
3
|
+
/**
|
|
4
|
+
* Exports chat messages in the specified format
|
|
5
|
+
*
|
|
6
|
+
* @private utility of `<Chat/>` component
|
|
7
|
+
*/
|
|
8
|
+
export declare function exportChatHistory(messages: ChatMessage[], format: ExportFormat, headerMarkdown?: string, participants?: Record<string, {
|
|
9
|
+
name: string;
|
|
10
|
+
avatarUrl?: string;
|
|
11
|
+
}>): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatMessage } from '../interfaces/ChatMessage';
|
|
2
|
+
/**
|
|
3
|
+
* Generates PDF content using HTML and triggers print dialog
|
|
4
|
+
*
|
|
5
|
+
* @private utility of `<Chat/>` component
|
|
6
|
+
*/
|
|
7
|
+
export declare function generatePdfContent(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: Record<string, {
|
|
8
|
+
name: string;
|
|
9
|
+
avatarUrl?: string;
|
|
10
|
+
}>): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatMessage } from '../interfaces/ChatMessage';
|
|
2
|
+
/**
|
|
3
|
+
* Converts chat messages to HTML format
|
|
4
|
+
*
|
|
5
|
+
* @private utility of `<Chat/>` component
|
|
6
|
+
*/
|
|
7
|
+
export declare function messagesToHtml(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: Record<string, {
|
|
8
|
+
name: string;
|
|
9
|
+
avatarUrl?: string;
|
|
10
|
+
}>): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatMessage } from '../interfaces/ChatMessage';
|
|
2
|
+
/**
|
|
3
|
+
* Converts chat messages to Markdown format
|
|
4
|
+
*
|
|
5
|
+
* @private utility of `<Chat/>` component
|
|
6
|
+
*/
|
|
7
|
+
export declare function messagesToMarkdown(messages: ChatMessage[], shareUrl: string, qrDataUrl?: string | null, headerMarkdown?: string, participants?: Record<string, {
|
|
8
|
+
name: string;
|
|
9
|
+
avatarUrl?: string;
|
|
10
|
+
}>): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatMessage } from '../interfaces/ChatMessage';
|
|
2
|
+
/**
|
|
3
|
+
* Converts chat messages to plain text format
|
|
4
|
+
*
|
|
5
|
+
* @private utility of `<Chat/>` component
|
|
6
|
+
*/
|
|
7
|
+
export declare function messagesToText(messages: ChatMessage[], shareUrl: string, headerMarkdown?: string, participants?: Record<string, {
|
|
8
|
+
name: string;
|
|
9
|
+
avatarUrl?: string;
|
|
10
|
+
}>): string;
|
|
@@ -301,6 +301,19 @@ export declare const DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME = "getPipelin
|
|
|
301
301
|
* @public exported from `@promptbook/core`
|
|
302
302
|
*/
|
|
303
303
|
export declare const DEFAULT_MAX_REQUESTS_PER_MINUTE = 60;
|
|
304
|
+
/**
|
|
305
|
+
* API request timeout in milliseconds
|
|
306
|
+
* Can be overridden via API_REQUEST_TIMEOUT environment variable
|
|
307
|
+
*
|
|
308
|
+
* @public exported from `@promptbook/core`
|
|
309
|
+
*/
|
|
310
|
+
export declare const API_REQUEST_TIMEOUT: number;
|
|
311
|
+
/**
|
|
312
|
+
* URL of the Promptbook logo
|
|
313
|
+
*
|
|
314
|
+
* @public exported from `@promptbook/core`
|
|
315
|
+
*/
|
|
316
|
+
export declare const PROMPTBOOK_LOGO_URL = "https://promptbook.studio/logos/logo-blue-white-256.png";
|
|
304
317
|
/**
|
|
305
318
|
* Indicates whether pipeline logic validation is enabled. When true, the pipeline logic is checked for consistency.
|
|
306
319
|
*
|
|
@@ -20,7 +20,8 @@ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
|
|
|
20
20
|
readonly title: AbstractTask<TTaskResult>['title'];
|
|
21
21
|
/**
|
|
22
22
|
* Callback that processes the task and updates the ongoing result
|
|
23
|
-
* @param
|
|
23
|
+
* @param updateOngoingResult Function to update the partial result of the task processing
|
|
24
|
+
* @param updateTldr Function to update tldr progress information
|
|
24
25
|
* @returns The final task result
|
|
25
26
|
*/
|
|
26
27
|
taskProcessCallback(updateOngoingResult: (newOngoingResult: PartialDeep<TTaskResult> & {
|
|
@@ -28,20 +29,10 @@ type CreateTaskOptions<TTaskResult extends AbstractTaskResult> = {
|
|
|
28
29
|
* Optional update of the task title
|
|
29
30
|
*/
|
|
30
31
|
readonly title?: AbstractTask<TTaskResult>['title'];
|
|
31
|
-
}) => void
|
|
32
|
-
/**
|
|
33
|
-
* Optional callback to provide custom tldr information
|
|
34
|
-
* @param createdAt When the task was created
|
|
35
|
-
* @param status Current task status
|
|
36
|
-
* @param currentValue Current partial result
|
|
37
|
-
* @param errors Current errors
|
|
38
|
-
* @param warnings Current warnings
|
|
39
|
-
* @returns Custom tldr information
|
|
40
|
-
*/
|
|
41
|
-
tldrProvider?(createdAt: Date, status: task_status, currentValue: PartialDeep<TTaskResult>, errors: Array<Error>, warnings: Array<Error>): {
|
|
32
|
+
}) => void, updateTldr: (tldrInfo: {
|
|
42
33
|
readonly percent: number_percent;
|
|
43
34
|
readonly message: string;
|
|
44
|
-
}
|
|
35
|
+
}) => void): Promise<TTaskResult>;
|
|
45
36
|
};
|
|
46
37
|
/**
|
|
47
38
|
* Helper to create a new task
|
|
@@ -119,6 +110,14 @@ export type AbstractTask<TTaskResult extends AbstractTaskResult> = {
|
|
|
119
110
|
* Gets a promise that resolves with the task result
|
|
120
111
|
*/
|
|
121
112
|
asPromise(options?: {
|
|
113
|
+
/**
|
|
114
|
+
* Do the task throws on error
|
|
115
|
+
*
|
|
116
|
+
* - If `true` when error occurs the returned promise will rejects
|
|
117
|
+
* - If `false` the promise will resolve with object with all listed errors and warnings and partial result
|
|
118
|
+
*
|
|
119
|
+
* @default true
|
|
120
|
+
*/
|
|
122
121
|
readonly isCrashedOnError?: boolean;
|
|
123
122
|
}): Promise<TTaskResult>;
|
|
124
123
|
/**
|
|
@@ -82,6 +82,14 @@ export declare abstract class OpenAiCompatibleExecutionTools implements LlmExecu
|
|
|
82
82
|
* Default model for completion variant.
|
|
83
83
|
*/
|
|
84
84
|
protected abstract getDefaultEmbeddingModel(): AvailableModel;
|
|
85
|
+
/**
|
|
86
|
+
* Makes a request with retry logic for network errors like ECONNRESET
|
|
87
|
+
*/
|
|
88
|
+
private makeRequestWithRetry;
|
|
89
|
+
/**
|
|
90
|
+
* Determines if an error is retryable (network-related errors)
|
|
91
|
+
*/
|
|
92
|
+
private isRetryableNetworkError;
|
|
85
93
|
}
|
|
86
94
|
/**
|
|
87
95
|
* TODO: [🛄] Some way how to re-wrap the errors from `OpenAiCompatibleExecutionTools`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { really_any } from './really_any';
|
|
2
|
+
/**
|
|
3
|
+
* Does nothing, but preserves the function in the bundle
|
|
4
|
+
* Compiler is tricked into thinking the function is used
|
|
5
|
+
*
|
|
6
|
+
* @param value any function to preserve
|
|
7
|
+
* @returns nothing
|
|
8
|
+
* @private within the repository
|
|
9
|
+
*/
|
|
10
|
+
export declare function $preserve(...value: Array<really_any>): void;
|
|
11
|
+
/**
|
|
12
|
+
* DO NOT USE THIS FUNCTION
|
|
13
|
+
* Only purpose of this function is to trick the compiler and javascript engine
|
|
14
|
+
* that `_preserved` array can be used in the future and should not be garbage collected
|
|
15
|
+
*
|
|
16
|
+
* @private internal for `preserve`
|
|
17
|
+
*/
|
|
18
|
+
export declare function __DO_NOT_USE_getPreserved(): Array<really_any>;
|
|
19
|
+
/**
|
|
20
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21
|
+
*/
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.100.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.100.0-45`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/fake-llm",
|
|
3
|
-
"version": "0.100.0-
|
|
3
|
+
"version": "0.100.0-46",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -96,13 +96,11 @@
|
|
|
96
96
|
"module": "./esm/index.es.js",
|
|
97
97
|
"typings": "./esm/typings/src/_packages/fake-llm.index.d.ts",
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@promptbook/core": "0.100.0-
|
|
99
|
+
"@promptbook/core": "0.100.0-46"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"crypto": "1.0.1",
|
|
103
103
|
"lorem-ipsum": "2.0.8",
|
|
104
|
-
"
|
|
105
|
-
"spacetrim": "0.11.59",
|
|
106
|
-
"waitasecond": "1.11.83"
|
|
104
|
+
"spacetrim": "0.11.59"
|
|
107
105
|
}
|
|
108
106
|
}
|
package/umd/index.umd.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('lorem-ipsum'), require('path'), require('prettier'), require('prettier/parser-
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'lorem-ipsum', 'path', 'prettier', 'prettier/parser-
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim, global.crypto, global.loremIpsum, null, global.
|
|
5
|
-
})(this, (function (exports, spaceTrim, crypto, loremIpsum, path,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('lorem-ipsum'), require('path'), require('prettier/parser-html'), require('prettier/parser-markdown'), require('prettier/standalone')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'lorem-ipsum', 'path', 'prettier/parser-html', 'prettier/parser-markdown', 'prettier/standalone'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim, global.crypto, global.loremIpsum, null, global.parserHtml, global.parserMarkdown, global.standalone));
|
|
5
|
+
})(this, (function (exports, spaceTrim, crypto, loremIpsum, path, parserHtml, parserMarkdown, standalone) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
9
|
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
10
10
|
var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
|
|
11
|
+
var parserMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(parserMarkdown);
|
|
11
12
|
|
|
12
13
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
13
14
|
/**
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
* @generated
|
|
24
25
|
* @see https://github.com/webgptorg/promptbook
|
|
25
26
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-46';
|
|
27
28
|
/**
|
|
28
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -202,6 +203,13 @@
|
|
|
202
203
|
newline: '\n',
|
|
203
204
|
skipEmptyLines: true,
|
|
204
205
|
});
|
|
206
|
+
/**
|
|
207
|
+
* API request timeout in milliseconds
|
|
208
|
+
* Can be overridden via API_REQUEST_TIMEOUT environment variable
|
|
209
|
+
*
|
|
210
|
+
* @public exported from `@promptbook/core`
|
|
211
|
+
*/
|
|
212
|
+
parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
|
|
205
213
|
/**
|
|
206
214
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
207
215
|
* TODO: [🧠][🧜♂️] Maybe join remoteServerUrl and path into single value
|
|
@@ -1997,9 +2005,9 @@
|
|
|
1997
2005
|
*/
|
|
1998
2006
|
function prettifyMarkdown(content) {
|
|
1999
2007
|
try {
|
|
2000
|
-
return
|
|
2008
|
+
return standalone.format(content, {
|
|
2001
2009
|
parser: 'markdown',
|
|
2002
|
-
plugins: [parserHtml__default["default"]],
|
|
2010
|
+
plugins: [parserMarkdown__default["default"], parserHtml__default["default"]],
|
|
2003
2011
|
// TODO: DRY - make some import or auto-copy of .prettierrc
|
|
2004
2012
|
endOfLine: 'lf',
|
|
2005
2013
|
tabWidth: 4,
|
|
@@ -2022,31 +2030,23 @@
|
|
|
2022
2030
|
}
|
|
2023
2031
|
}
|
|
2024
2032
|
|
|
2033
|
+
/**
|
|
2034
|
+
* @private internal for `preserve`
|
|
2035
|
+
*/
|
|
2036
|
+
const _preserved = [];
|
|
2025
2037
|
/**
|
|
2026
2038
|
* Does nothing, but preserves the function in the bundle
|
|
2027
2039
|
* Compiler is tricked into thinking the function is used
|
|
2028
2040
|
*
|
|
2029
2041
|
* @param value any function to preserve
|
|
2030
2042
|
* @returns nothing
|
|
2031
|
-
* @private
|
|
2032
|
-
*/
|
|
2033
|
-
function preserve(
|
|
2034
|
-
|
|
2035
|
-
(async () => {
|
|
2036
|
-
// TODO: [💩] Change to `await forEver` or `forTime(Infinity)`
|
|
2037
|
-
await waitasecond.forTime(100000000);
|
|
2038
|
-
// [1]
|
|
2039
|
-
try {
|
|
2040
|
-
await func();
|
|
2041
|
-
}
|
|
2042
|
-
finally {
|
|
2043
|
-
// do nothing
|
|
2044
|
-
}
|
|
2045
|
-
})();
|
|
2043
|
+
* @private within the repository
|
|
2044
|
+
*/
|
|
2045
|
+
function $preserve(...value) {
|
|
2046
|
+
_preserved.push(...value);
|
|
2046
2047
|
}
|
|
2047
2048
|
/**
|
|
2048
|
-
*
|
|
2049
|
-
* TODO: [1] This maybe does memory leak
|
|
2049
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2050
2050
|
*/
|
|
2051
2051
|
|
|
2052
2052
|
// Note: [💎]
|
|
@@ -2074,25 +2074,25 @@
|
|
|
2074
2074
|
// Note: [💎]
|
|
2075
2075
|
// Note: Using direct eval, following variables are in same scope as eval call so they are accessible from inside the evaluated script:
|
|
2076
2076
|
const spaceTrim = (_) => spaceTrim__default["default"](_);
|
|
2077
|
-
preserve(spaceTrim);
|
|
2077
|
+
$preserve(spaceTrim);
|
|
2078
2078
|
const removeQuotes$1 = removeQuotes;
|
|
2079
|
-
preserve(removeQuotes$1);
|
|
2079
|
+
$preserve(removeQuotes$1);
|
|
2080
2080
|
const unwrapResult$1 = unwrapResult;
|
|
2081
|
-
preserve(unwrapResult$1);
|
|
2081
|
+
$preserve(unwrapResult$1);
|
|
2082
2082
|
const trimEndOfCodeBlock$1 = trimEndOfCodeBlock;
|
|
2083
|
-
preserve(trimEndOfCodeBlock$1);
|
|
2083
|
+
$preserve(trimEndOfCodeBlock$1);
|
|
2084
2084
|
const trimCodeBlock$1 = trimCodeBlock;
|
|
2085
|
-
preserve(trimCodeBlock$1);
|
|
2085
|
+
$preserve(trimCodeBlock$1);
|
|
2086
2086
|
// TODO: DRY [🍯]
|
|
2087
2087
|
const trim = (str) => str.trim();
|
|
2088
|
-
preserve(trim);
|
|
2088
|
+
$preserve(trim);
|
|
2089
2089
|
// TODO: DRY [🍯]
|
|
2090
2090
|
const reverse = (str) => str.split('').reverse().join('');
|
|
2091
|
-
preserve(reverse);
|
|
2091
|
+
$preserve(reverse);
|
|
2092
2092
|
const removeEmojis$1 = removeEmojis;
|
|
2093
|
-
preserve(removeEmojis$1);
|
|
2093
|
+
$preserve(removeEmojis$1);
|
|
2094
2094
|
const prettifyMarkdown$1 = prettifyMarkdown;
|
|
2095
|
-
preserve(prettifyMarkdown$1);
|
|
2095
|
+
$preserve(prettifyMarkdown$1);
|
|
2096
2096
|
//-------[n12:]---
|
|
2097
2097
|
const capitalize$1 = capitalize;
|
|
2098
2098
|
const decapitalize$1 = decapitalize;
|
|
@@ -2108,18 +2108,18 @@
|
|
|
2108
2108
|
// TODO: DRY [🍯]
|
|
2109
2109
|
Array.from(parseKeywordsFromString(input)).join(', '); /* <- TODO: [🧠] What is the best format comma list, bullet list,...? */
|
|
2110
2110
|
const normalizeTo_SCREAMING_CASE$1 = normalizeTo_SCREAMING_CASE;
|
|
2111
|
-
preserve(capitalize$1);
|
|
2112
|
-
preserve(decapitalize$1);
|
|
2113
|
-
preserve(nameToUriPart$1);
|
|
2114
|
-
preserve(nameToUriParts$1);
|
|
2115
|
-
preserve(removeDiacritics$1);
|
|
2116
|
-
preserve(normalizeWhitespaces$1);
|
|
2117
|
-
preserve(normalizeToKebabCase$1);
|
|
2118
|
-
preserve(normalizeTo_camelCase$1);
|
|
2119
|
-
preserve(normalizeTo_snake_case$1);
|
|
2120
|
-
preserve(normalizeTo_PascalCase$1);
|
|
2121
|
-
preserve(parseKeywords);
|
|
2122
|
-
preserve(normalizeTo_SCREAMING_CASE$1);
|
|
2111
|
+
$preserve(capitalize$1);
|
|
2112
|
+
$preserve(decapitalize$1);
|
|
2113
|
+
$preserve(nameToUriPart$1);
|
|
2114
|
+
$preserve(nameToUriParts$1);
|
|
2115
|
+
$preserve(removeDiacritics$1);
|
|
2116
|
+
$preserve(normalizeWhitespaces$1);
|
|
2117
|
+
$preserve(normalizeToKebabCase$1);
|
|
2118
|
+
$preserve(normalizeTo_camelCase$1);
|
|
2119
|
+
$preserve(normalizeTo_snake_case$1);
|
|
2120
|
+
$preserve(normalizeTo_PascalCase$1);
|
|
2121
|
+
$preserve(parseKeywords);
|
|
2122
|
+
$preserve(normalizeTo_SCREAMING_CASE$1);
|
|
2123
2123
|
//-------[/n12]---
|
|
2124
2124
|
if (!script.includes('return')) {
|
|
2125
2125
|
script = `return ${script}`;
|