@promptbook/remote-client 0.84.0-12 → 0.84.0-14
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 +32 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/config.d.ts +12 -0
- package/esm/typings/src/utils/editable/edit-pipeline-string/deflatePipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/editable/utils/isFlatPipeline.test.d.ts +1 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.d.ts +10 -0
- package/esm/typings/src/utils/files/mimeTypeToExtension.test.d.ts +1 -0
- package/package.json +2 -2
- package/umd/index.umd.js +32 -6
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -19,7 +19,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/promptbook
|
|
21
21
|
*/
|
|
22
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-
|
|
22
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.84.0-13';
|
|
23
23
|
/**
|
|
24
24
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
25
25
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -430,6 +430,12 @@ var DEFAULT_BOOK_TITLE = "\u2728 Untitled Book";
|
|
|
430
430
|
* @public exported from `@promptbook/core`
|
|
431
431
|
*/
|
|
432
432
|
var DEFAULT_TASK_TITLE = "Task";
|
|
433
|
+
/**
|
|
434
|
+
* When the pipeline is flat and no name of return parameter is provided, this name is used
|
|
435
|
+
*
|
|
436
|
+
* @public exported from `@promptbook/core`
|
|
437
|
+
*/
|
|
438
|
+
var DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = 'result';
|
|
433
439
|
/**
|
|
434
440
|
* Timeout for the connections in milliseconds
|
|
435
441
|
*
|
|
@@ -4580,12 +4586,15 @@ function isFlatPipeline(pipelineString) {
|
|
|
4580
4586
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
4581
4587
|
pipelineString = spaceTrim$1(pipelineString);
|
|
4582
4588
|
var isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
4583
|
-
|
|
4584
|
-
|
|
4589
|
+
//const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
|
|
4590
|
+
var isBacktickBlockUsed = pipelineString.includes('```');
|
|
4591
|
+
var isQuoteBlocksUsed = /^>\s+/m.test(pipelineString);
|
|
4592
|
+
var isBlocksUsed = isBacktickBlockUsed || isQuoteBlocksUsed;
|
|
4593
|
+
// TODO: [🧉] Also (double)check
|
|
4585
4594
|
// > const usedCommands
|
|
4586
4595
|
// > const isBlocksUsed
|
|
4587
4596
|
// > const returnStatementCount
|
|
4588
|
-
var isFlat = !isMarkdownBeginningWithHeadline && isLastLineReturnStatement
|
|
4597
|
+
var isFlat = !isMarkdownBeginningWithHeadline && !isBlocksUsed; /* && isLastLineReturnStatement */
|
|
4589
4598
|
return isFlat;
|
|
4590
4599
|
}
|
|
4591
4600
|
|
|
@@ -4599,9 +4608,26 @@ function deflatePipeline(pipelineString) {
|
|
|
4599
4608
|
return pipelineString;
|
|
4600
4609
|
}
|
|
4601
4610
|
var pipelineStringLines = pipelineString.split('\n');
|
|
4602
|
-
var
|
|
4611
|
+
var potentialReturnStatement = pipelineStringLines.pop();
|
|
4612
|
+
var returnStatement;
|
|
4613
|
+
if (/(-|=)>\s*\{.*\}/.test(potentialReturnStatement)) {
|
|
4614
|
+
// Note: Last line is return statement
|
|
4615
|
+
returnStatement = potentialReturnStatement;
|
|
4616
|
+
}
|
|
4617
|
+
else {
|
|
4618
|
+
// Note: Last line is not a return statement
|
|
4619
|
+
returnStatement = "-> {".concat(DEFAULT_BOOK_OUTPUT_PARAMETER_NAME, "}");
|
|
4620
|
+
pipelineStringLines.push(potentialReturnStatement);
|
|
4621
|
+
}
|
|
4603
4622
|
var prompt = spaceTrim$1(pipelineStringLines.join('\n'));
|
|
4604
|
-
|
|
4623
|
+
var quotedPrompt;
|
|
4624
|
+
if (prompt.split('\n').length <= 1) {
|
|
4625
|
+
quotedPrompt = "> ".concat(prompt);
|
|
4626
|
+
}
|
|
4627
|
+
else {
|
|
4628
|
+
quotedPrompt = spaceTrim$1(function (block) { return "\n ```\n ".concat(block(prompt.split('`').join('\\`')), "\n ```\n "); });
|
|
4629
|
+
}
|
|
4630
|
+
pipelineString = validatePipelineString(spaceTrim$1(function (block) { return "\n # ".concat(DEFAULT_BOOK_TITLE, "\n\n ## Prompt\n\n ").concat(block(quotedPrompt), "\n\n ").concat(returnStatement, "\n "); }));
|
|
4605
4631
|
// <- TODO: Maybe use book` notation
|
|
4606
4632
|
return pipelineString;
|
|
4607
4633
|
}
|