@promptbook/markitdown 0.100.0-33 → 0.100.0-35
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
CHANGED
|
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
26
26
|
* @generated
|
|
27
27
|
* @see https://github.com/webgptorg/promptbook
|
|
28
28
|
*/
|
|
29
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-
|
|
29
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.100.0-35';
|
|
30
30
|
/**
|
|
31
31
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
32
32
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2586,6 +2586,55 @@ function createTask(options) {
|
|
|
2586
2586
|
return status;
|
|
2587
2587
|
// <- Note: [1] --||--
|
|
2588
2588
|
},
|
|
2589
|
+
get tldr() {
|
|
2590
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2591
|
+
// Derive a short progress summary from currentValue, status and any errors/warnings.
|
|
2592
|
+
const cv = currentValue;
|
|
2593
|
+
// Try several common places where a percent might be stored on the partial result
|
|
2594
|
+
let percentRaw = (_f = (_d = (_b = (_a = cv === null || cv === void 0 ? void 0 : cv.tldr) === null || _a === void 0 ? void 0 : _a.percent) !== null && _b !== void 0 ? _b : (_c = cv === null || cv === void 0 ? void 0 : cv.usage) === null || _c === void 0 ? void 0 : _c.percent) !== null && _d !== void 0 ? _d : (_e = cv === null || cv === void 0 ? void 0 : cv.progress) === null || _e === void 0 ? void 0 : _e.percent) !== null && _f !== void 0 ? _f : cv === null || cv === void 0 ? void 0 : cv.percent;
|
|
2595
|
+
// If we didn't find a numeric percent, infer from status
|
|
2596
|
+
if (typeof percentRaw !== 'number') {
|
|
2597
|
+
if (status === 'FINISHED') {
|
|
2598
|
+
percentRaw = 1;
|
|
2599
|
+
}
|
|
2600
|
+
else if (status === 'ERROR') {
|
|
2601
|
+
percentRaw = 0;
|
|
2602
|
+
}
|
|
2603
|
+
else {
|
|
2604
|
+
percentRaw = 0;
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
// Clamp to [0,1]
|
|
2608
|
+
let percent = Number(percentRaw) || 0;
|
|
2609
|
+
if (percent < 0)
|
|
2610
|
+
percent = 0;
|
|
2611
|
+
if (percent > 1)
|
|
2612
|
+
percent = 1;
|
|
2613
|
+
// Build a short message: prefer explicit tldr.message, then common summary/message fields, then errors/warnings, then status
|
|
2614
|
+
const messageFromResult = (_k = (_j = (_h = (_g = cv === null || cv === void 0 ? void 0 : cv.tldr) === null || _g === void 0 ? void 0 : _g.message) !== null && _h !== void 0 ? _h : cv === null || cv === void 0 ? void 0 : cv.message) !== null && _j !== void 0 ? _j : cv === null || cv === void 0 ? void 0 : cv.summary) !== null && _k !== void 0 ? _k : cv === null || cv === void 0 ? void 0 : cv.statusMessage;
|
|
2615
|
+
let message = messageFromResult;
|
|
2616
|
+
if (!message) {
|
|
2617
|
+
if (errors.length) {
|
|
2618
|
+
message = errors[errors.length - 1].message || 'Error';
|
|
2619
|
+
}
|
|
2620
|
+
else if (warnings.length) {
|
|
2621
|
+
message = warnings[warnings.length - 1].message || 'Warning';
|
|
2622
|
+
}
|
|
2623
|
+
else if (status === 'FINISHED') {
|
|
2624
|
+
message = 'Finished';
|
|
2625
|
+
}
|
|
2626
|
+
else if (status === 'ERROR') {
|
|
2627
|
+
message = 'Error';
|
|
2628
|
+
}
|
|
2629
|
+
else {
|
|
2630
|
+
message = 'Running';
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
return {
|
|
2634
|
+
percent: percent,
|
|
2635
|
+
message,
|
|
2636
|
+
};
|
|
2637
|
+
},
|
|
2589
2638
|
get createdAt() {
|
|
2590
2639
|
return createdAt;
|
|
2591
2640
|
// <- Note: [1] --||--
|