@promptbook/wizard 0.100.0-43 → 0.100.0-45
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 +59 -71
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +10 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +12 -0
- 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 +134 -0
- package/esm/typings/src/book-components/Chat/interfaces/ChatMessage.d.ts +30 -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 +6 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +4 -13
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +59 -71
- package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js
CHANGED
@@ -49,7 +49,7 @@
|
|
49
49
|
* @generated
|
50
50
|
* @see https://github.com/webgptorg/promptbook
|
51
51
|
*/
|
52
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-
|
52
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-45';
|
53
53
|
/**
|
54
54
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
55
55
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
@@ -7182,7 +7182,7 @@
|
|
7182
7182
|
* @private internal helper function
|
7183
7183
|
*/
|
7184
7184
|
function createTask(options) {
|
7185
|
-
const { taskType, taskProcessCallback
|
7185
|
+
const { taskType, taskProcessCallback } = options;
|
7186
7186
|
let { title } = options;
|
7187
7187
|
// TODO: [🐙] DRY
|
7188
7188
|
const taskId = `${taskType.toLowerCase().substring(0, 4)}-${$randomToken(8 /* <- TODO: To global config + Use Base58 to avoid similar char conflicts */)}`;
|
@@ -7192,6 +7192,7 @@
|
|
7192
7192
|
const errors = [];
|
7193
7193
|
const warnings = [];
|
7194
7194
|
let currentValue = {};
|
7195
|
+
let customTldr = null;
|
7195
7196
|
const partialResultSubject = new rxjs.Subject();
|
7196
7197
|
// <- Note: Not using `BehaviorSubject` because on error we can't access the last value
|
7197
7198
|
const finalResultPromise = /* not await */ taskProcessCallback((newOngoingResult) => {
|
@@ -7202,6 +7203,9 @@
|
|
7202
7203
|
Object.assign(currentValue, newOngoingResult);
|
7203
7204
|
// <- TODO: assign deep
|
7204
7205
|
partialResultSubject.next(newOngoingResult);
|
7206
|
+
}, (tldrInfo) => {
|
7207
|
+
customTldr = tldrInfo;
|
7208
|
+
updatedAt = new Date();
|
7205
7209
|
});
|
7206
7210
|
finalResultPromise
|
7207
7211
|
.catch((error) => {
|
@@ -7257,9 +7261,9 @@
|
|
7257
7261
|
},
|
7258
7262
|
get tldr() {
|
7259
7263
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
7260
|
-
// Use custom tldr
|
7261
|
-
if (
|
7262
|
-
return
|
7264
|
+
// Use custom tldr if available
|
7265
|
+
if (customTldr) {
|
7266
|
+
return customTldr;
|
7263
7267
|
}
|
7264
7268
|
// Fallback to default implementation
|
7265
7269
|
const cv = currentValue;
|
@@ -10323,75 +10327,59 @@
|
|
10323
10327
|
const pipelineExecutor = (inputParameters) => createTask({
|
10324
10328
|
taskType: 'EXECUTION',
|
10325
10329
|
title: pipeline.title,
|
10326
|
-
taskProcessCallback(updateOngoingResult) {
|
10330
|
+
taskProcessCallback(updateOngoingResult, updateTldr) {
|
10327
10331
|
return pipelineExecutorWithCallback(inputParameters, async (newOngoingResult) => {
|
10332
|
+
var _a;
|
10328
10333
|
updateOngoingResult(newOngoingResult);
|
10329
|
-
|
10330
|
-
|
10331
|
-
|
10332
|
-
|
10333
|
-
|
10334
|
-
|
10335
|
-
|
10336
|
-
|
10337
|
-
|
10338
|
-
|
10339
|
-
|
10340
|
-
|
10341
|
-
|
10342
|
-
|
10343
|
-
|
10344
|
-
|
10345
|
-
|
10346
|
-
message: errorMessage,
|
10347
|
-
};
|
10348
|
-
}
|
10349
|
-
// Calculate progress based on pipeline tasks
|
10350
|
-
const totalTasks = pipeline.tasks.length;
|
10351
|
-
let completedTasks = 0;
|
10352
|
-
let currentTaskName = '';
|
10353
|
-
// Check execution report for completed tasks
|
10354
|
-
if ((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) {
|
10355
|
-
const executedTaskTitles = new Set(cv.executionReport.promptExecutions.map((execution) => execution.prompt.title));
|
10356
|
-
// Count completed tasks by matching titles
|
10357
|
-
const completedTasksByTitle = pipeline.tasks.filter(task => executedTaskTitles.has(task.title));
|
10358
|
-
completedTasks = completedTasksByTitle.length;
|
10359
|
-
// Find current task being executed (first task not yet completed)
|
10360
|
-
const remainingTasks = pipeline.tasks.filter(task => !executedTaskTitles.has(task.title));
|
10361
|
-
if (remainingTasks.length > 0) {
|
10362
|
-
currentTaskName = remainingTasks[0].name;
|
10334
|
+
// Calculate and update tldr based on pipeline progress
|
10335
|
+
const cv = newOngoingResult;
|
10336
|
+
// Calculate progress based on pipeline tasks
|
10337
|
+
const totalTasks = pipeline.tasks.length;
|
10338
|
+
let completedTasks = 0;
|
10339
|
+
let currentTaskName = '';
|
10340
|
+
// Check execution report for completed tasks
|
10341
|
+
if ((_a = cv === null || cv === void 0 ? void 0 : cv.executionReport) === null || _a === void 0 ? void 0 : _a.promptExecutions) {
|
10342
|
+
const executedTaskTitles = new Set(cv.executionReport.promptExecutions.map((execution) => execution.prompt.title));
|
10343
|
+
// Count completed tasks by matching titles
|
10344
|
+
const completedTasksByTitle = pipeline.tasks.filter((task) => executedTaskTitles.has(task.title));
|
10345
|
+
completedTasks = completedTasksByTitle.length;
|
10346
|
+
// Find current task being executed (first task not yet completed)
|
10347
|
+
const remainingTasks = pipeline.tasks.filter((task) => !executedTaskTitles.has(task.title));
|
10348
|
+
if (remainingTasks.length > 0) {
|
10349
|
+
currentTaskName = remainingTasks[0].name;
|
10350
|
+
}
|
10363
10351
|
}
|
10364
|
-
|
10365
|
-
|
10366
|
-
|
10367
|
-
|
10368
|
-
|
10369
|
-
|
10370
|
-
|
10371
|
-
|
10372
|
-
|
10373
|
-
|
10374
|
-
|
10375
|
-
|
10376
|
-
|
10377
|
-
|
10378
|
-
|
10379
|
-
|
10380
|
-
|
10381
|
-
|
10382
|
-
|
10383
|
-
|
10384
|
-
|
10385
|
-
|
10386
|
-
|
10387
|
-
|
10388
|
-
|
10389
|
-
|
10390
|
-
|
10391
|
-
|
10392
|
-
|
10393
|
-
|
10394
|
-
};
|
10352
|
+
// Calculate progress percentage
|
10353
|
+
let percent = totalTasks > 0 ? completedTasks / totalTasks : 0;
|
10354
|
+
// Add time-based progress for current task (assuming 5 minutes total)
|
10355
|
+
if (completedTasks < totalTasks) {
|
10356
|
+
const elapsedMs = new Date().getTime() - new Date().getTime(); // Will be overridden by actual elapsed time in task
|
10357
|
+
const totalMs = 5 * 60 * 1000; // 5 minutes
|
10358
|
+
const timeProgress = Math.min(elapsedMs / totalMs, 1);
|
10359
|
+
// Add partial progress for current task
|
10360
|
+
percent += (1 / totalTasks) * timeProgress;
|
10361
|
+
}
|
10362
|
+
// Clamp to [0,1]
|
10363
|
+
percent = Math.min(Math.max(percent, 0), 1);
|
10364
|
+
// Generate message
|
10365
|
+
let message = '';
|
10366
|
+
if (currentTaskName) {
|
10367
|
+
// Find the task to get its title
|
10368
|
+
const currentTask = pipeline.tasks.find((task) => task.name === currentTaskName);
|
10369
|
+
const taskTitle = (currentTask === null || currentTask === void 0 ? void 0 : currentTask.title) || currentTaskName;
|
10370
|
+
message = `Working on task ${taskTitle}`;
|
10371
|
+
}
|
10372
|
+
else if (completedTasks === 0) {
|
10373
|
+
message = 'Starting pipeline execution';
|
10374
|
+
}
|
10375
|
+
else {
|
10376
|
+
message = `Processing pipeline (${completedTasks}/${totalTasks} tasks completed)`;
|
10377
|
+
}
|
10378
|
+
updateTldr({
|
10379
|
+
percent: percent,
|
10380
|
+
message,
|
10381
|
+
});
|
10382
|
+
});
|
10395
10383
|
},
|
10396
10384
|
});
|
10397
10385
|
// <- TODO: Make types such as there is no need to do `as` for `createTask`
|