@promptbook/remote-server 0.85.0-3 → 0.85.0-4
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 +38 -21
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/execution/ExecutionTask.d.ts +7 -3
- package/package.json +2 -2
- package/umd/index.umd.js +38 -21
- package/umd/index.umd.js.map +1 -1
package/esm/index.es.js
CHANGED
|
@@ -31,7 +31,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
31
31
|
* @generated
|
|
32
32
|
* @see https://github.com/webgptorg/promptbook
|
|
33
33
|
*/
|
|
34
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-
|
|
34
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.85.0-3';
|
|
35
35
|
/**
|
|
36
36
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
37
37
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2009,7 +2009,7 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
2009
2009
|
*/
|
|
2010
2010
|
function createTask(options) {
|
|
2011
2011
|
var taskType = options.taskType, taskProcessCallback = options.taskProcessCallback;
|
|
2012
|
-
var taskId = "".concat(taskType.toLowerCase(), "-").concat($randomToken(
|
|
2012
|
+
var taskId = "".concat(taskType.toLowerCase().substring(0, 4), "-").concat($randomToken(8 /* <- TODO: !!! To global config + Use Base58 to avoid simmilar char conflicts */));
|
|
2013
2013
|
var partialResultSubject = new BehaviorSubject({});
|
|
2014
2014
|
var finalResultPromise = /* not await */ taskProcessCallback(function (newOngoingResult) {
|
|
2015
2015
|
partialResultSubject.next(newOngoingResult);
|
|
@@ -2041,6 +2041,9 @@ function createTask(options) {
|
|
|
2041
2041
|
isCrashedOnError: true,
|
|
2042
2042
|
})));
|
|
2043
2043
|
},
|
|
2044
|
+
get currentValue() {
|
|
2045
|
+
return partialResultSubject.value;
|
|
2046
|
+
},
|
|
2044
2047
|
};
|
|
2045
2048
|
}
|
|
2046
2049
|
/**
|
|
@@ -6959,27 +6962,29 @@ function startRemoteServer(options) {
|
|
|
6959
6962
|
app.get("".concat(rootPath, "/executions/:taskId"), function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
6960
6963
|
var taskId, execution;
|
|
6961
6964
|
return __generator(this, function (_a) {
|
|
6962
|
-
taskId = request.
|
|
6965
|
+
taskId = request.params.taskId;
|
|
6963
6966
|
execution = runningExecutionTasks.find(function (executionTask) { return executionTask.taskId === taskId; });
|
|
6964
6967
|
if (execution === undefined) {
|
|
6965
6968
|
response.status(404).send("Execution \"".concat(taskId, "\" not found"));
|
|
6966
6969
|
return [2 /*return*/];
|
|
6967
6970
|
}
|
|
6968
|
-
response.send(execution);
|
|
6971
|
+
response.send(execution.currentValue);
|
|
6969
6972
|
return [2 /*return*/];
|
|
6970
6973
|
});
|
|
6971
6974
|
}); });
|
|
6972
6975
|
app.post("".concat(rootPath, "/executions/new"), function (request, response) { return __awaiter(_this, void 0, void 0, function () {
|
|
6973
|
-
var inputParameters, pipelineUrl, pipeline, llm, fs, executables, tools, pipelineExecutor, executionTask;
|
|
6976
|
+
var inputParameters, pipelineUrl, pipeline, llm, fs, executables, tools, pipelineExecutor, executionTask, error_1;
|
|
6974
6977
|
var _a;
|
|
6975
6978
|
return __generator(this, function (_b) {
|
|
6976
6979
|
switch (_b.label) {
|
|
6977
6980
|
case 0:
|
|
6981
|
+
_b.trys.push([0, 5, , 6]);
|
|
6978
6982
|
inputParameters = request.body.inputParameters;
|
|
6979
6983
|
pipelineUrl = request.body.pipelineUrl || request.body.book;
|
|
6980
6984
|
return [4 /*yield*/, (collection === null || collection === void 0 ? void 0 : collection.getPipelineByUrl(pipelineUrl))];
|
|
6981
6985
|
case 1:
|
|
6982
6986
|
pipeline = _b.sent();
|
|
6987
|
+
// <- TODO: !!!!!! NotFoundError
|
|
6983
6988
|
if (pipeline === undefined) {
|
|
6984
6989
|
response.status(404).send("Pipeline \"".concat(pipelineUrl, "\" not found"));
|
|
6985
6990
|
return [2 /*return*/];
|
|
@@ -7007,7 +7012,19 @@ function startRemoteServer(options) {
|
|
|
7007
7012
|
executionTask = pipelineExecutor(inputParameters);
|
|
7008
7013
|
runningExecutionTasks.push(executionTask);
|
|
7009
7014
|
response.send(executionTask);
|
|
7010
|
-
|
|
7015
|
+
// TODO: !!!!!! Remove this:
|
|
7016
|
+
executionTask.asObservable().subscribe(function (_) {
|
|
7017
|
+
console.log('!!!', _);
|
|
7018
|
+
});
|
|
7019
|
+
return [3 /*break*/, 6];
|
|
7020
|
+
case 5:
|
|
7021
|
+
error_1 = _b.sent();
|
|
7022
|
+
if (!(error_1 instanceof Error)) {
|
|
7023
|
+
throw error_1;
|
|
7024
|
+
}
|
|
7025
|
+
response.status(400).send({ error: serializeError(error_1) });
|
|
7026
|
+
return [3 /*break*/, 6];
|
|
7027
|
+
case 6: return [2 /*return*/];
|
|
7011
7028
|
}
|
|
7012
7029
|
});
|
|
7013
7030
|
}); });
|
|
@@ -7072,7 +7089,7 @@ function startRemoteServer(options) {
|
|
|
7072
7089
|
}); };
|
|
7073
7090
|
// -----------
|
|
7074
7091
|
socket.on('prompt-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
7075
|
-
var identification, prompt, executionTools, llm, _a, promptResult, _b,
|
|
7092
|
+
var identification, prompt, executionTools, llm, _a, promptResult, _b, error_2;
|
|
7076
7093
|
return __generator(this, function (_c) {
|
|
7077
7094
|
switch (_c.label) {
|
|
7078
7095
|
case 0:
|
|
@@ -7141,11 +7158,11 @@ function startRemoteServer(options) {
|
|
|
7141
7158
|
socket.emit('prompt-response', { promptResult: promptResult } /* <- Note: [🤛] */);
|
|
7142
7159
|
return [3 /*break*/, 15];
|
|
7143
7160
|
case 13:
|
|
7144
|
-
|
|
7145
|
-
if (!(
|
|
7146
|
-
throw
|
|
7161
|
+
error_2 = _c.sent();
|
|
7162
|
+
if (!(error_2 instanceof Error)) {
|
|
7163
|
+
throw error_2;
|
|
7147
7164
|
}
|
|
7148
|
-
socket.emit('error', serializeError(
|
|
7165
|
+
socket.emit('error', serializeError(error_2) /* <- Note: [🤛] */);
|
|
7149
7166
|
return [3 /*break*/, 15];
|
|
7150
7167
|
case 14:
|
|
7151
7168
|
socket.disconnect();
|
|
@@ -7157,7 +7174,7 @@ function startRemoteServer(options) {
|
|
|
7157
7174
|
// -----------
|
|
7158
7175
|
// TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
|
|
7159
7176
|
socket.on('listModels-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
7160
|
-
var identification, executionTools, llm, models,
|
|
7177
|
+
var identification, executionTools, llm, models, error_3;
|
|
7161
7178
|
return __generator(this, function (_a) {
|
|
7162
7179
|
switch (_a.label) {
|
|
7163
7180
|
case 0:
|
|
@@ -7178,11 +7195,11 @@ function startRemoteServer(options) {
|
|
|
7178
7195
|
socket.emit('listModels-response', { models: models } /* <- Note: [🤛] */);
|
|
7179
7196
|
return [3 /*break*/, 6];
|
|
7180
7197
|
case 4:
|
|
7181
|
-
|
|
7182
|
-
if (!(
|
|
7183
|
-
throw
|
|
7198
|
+
error_3 = _a.sent();
|
|
7199
|
+
if (!(error_3 instanceof Error)) {
|
|
7200
|
+
throw error_3;
|
|
7184
7201
|
}
|
|
7185
|
-
socket.emit('error', serializeError(
|
|
7202
|
+
socket.emit('error', serializeError(error_3));
|
|
7186
7203
|
return [3 /*break*/, 6];
|
|
7187
7204
|
case 5:
|
|
7188
7205
|
socket.disconnect();
|
|
@@ -7194,7 +7211,7 @@ function startRemoteServer(options) {
|
|
|
7194
7211
|
// -----------
|
|
7195
7212
|
// TODO: [👒] Listing models (and checking configuration) probbably should go through REST API not Socket.io
|
|
7196
7213
|
socket.on('preparePipeline-request', function (request) { return __awaiter(_this, void 0, void 0, function () {
|
|
7197
|
-
var identification, pipeline, executionTools, preparedPipeline,
|
|
7214
|
+
var identification, pipeline, executionTools, preparedPipeline, error_4;
|
|
7198
7215
|
return __generator(this, function (_a) {
|
|
7199
7216
|
switch (_a.label) {
|
|
7200
7217
|
case 0:
|
|
@@ -7214,11 +7231,11 @@ function startRemoteServer(options) {
|
|
|
7214
7231
|
socket.emit('preparePipeline-response', { preparedPipeline: preparedPipeline } /* <- Note: [🤛] */);
|
|
7215
7232
|
return [3 /*break*/, 6];
|
|
7216
7233
|
case 4:
|
|
7217
|
-
|
|
7218
|
-
if (!(
|
|
7219
|
-
throw
|
|
7234
|
+
error_4 = _a.sent();
|
|
7235
|
+
if (!(error_4 instanceof Error)) {
|
|
7236
|
+
throw error_4;
|
|
7220
7237
|
}
|
|
7221
|
-
socket.emit('error', serializeError(
|
|
7238
|
+
socket.emit('error', serializeError(error_4));
|
|
7222
7239
|
return [3 /*break*/, 6];
|
|
7223
7240
|
case 5:
|
|
7224
7241
|
socket.disconnect();
|