@xpert-ai/plugin-sdk 3.7.1 → 3.7.2
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/index.cjs.js +78 -834
- package/index.esm.js +77 -834
- package/package.json +4 -1
- package/src/lib/agent/middleware/types.d.ts +72 -7
- package/src/lib/ai-model/ai-model.d.ts +3 -1
- package/src/lib/core/utils.d.ts +6 -0
package/index.esm.js
CHANGED
|
@@ -2,7 +2,8 @@ import { Module, Logger, applyDecorators, SetMetadata, HttpException, HttpStatus
|
|
|
2
2
|
import { MODULE_METADATA } from '@nestjs/common/constants';
|
|
3
3
|
import { pick } from 'lodash-es';
|
|
4
4
|
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
5
|
-
import {
|
|
5
|
+
import { Subject, filter } from 'rxjs';
|
|
6
|
+
import { LanguagesEnum, AiModelTypeEnum, ParameterType, PriceType, FetchFrom, ModelFeature, ModelPropertyKey } from '@metad/contracts';
|
|
6
7
|
export { IColumnDef, IDSSchema, IDSTable, TDocumentAsset } from '@metad/contracts';
|
|
7
8
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
8
9
|
import { ExtractJwt } from 'passport-jwt';
|
|
@@ -22,6 +23,8 @@ import { createInstance } from 'i18next';
|
|
|
22
23
|
import FsBackend from 'i18next-fs-backend';
|
|
23
24
|
import * as yaml from 'yaml';
|
|
24
25
|
import yaml__default from 'yaml';
|
|
26
|
+
import Ajv from 'ajv';
|
|
27
|
+
import schemaDraft04 from 'ajv/dist/refs/json-schema-draft-06.json';
|
|
25
28
|
import * as _axios from 'axios';
|
|
26
29
|
import { ChatOpenAICompletions } from '@langchain/openai';
|
|
27
30
|
import { Document } from '@langchain/core/documents';
|
|
@@ -102,44 +105,6 @@ function createPluginLogger(scope, baseMeta = {}) {
|
|
|
102
105
|
const INTEGRATION_STRATEGY = 'INTEGRATION_STRATEGY';
|
|
103
106
|
const IntegrationStrategyKey = (provider)=>applyDecorators(SetMetadata(INTEGRATION_STRATEGY, provider), SetMetadata(STRATEGY_META_KEY, INTEGRATION_STRATEGY));
|
|
104
107
|
|
|
105
|
-
/******************************************************************************
|
|
106
|
-
Copyright (c) Microsoft Corporation.
|
|
107
|
-
|
|
108
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
109
|
-
purpose with or without fee is hereby granted.
|
|
110
|
-
|
|
111
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
112
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
113
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
114
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
115
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
116
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
117
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
118
|
-
***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ function _instanceof$2(left, right) {
|
|
119
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
120
|
-
return !!right[Symbol.hasInstance](left);
|
|
121
|
-
} else {
|
|
122
|
-
return left instanceof right;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
var extendStatics = function extendStatics1(d, b) {
|
|
126
|
-
extendStatics = Object.setPrototypeOf || _instanceof$2({
|
|
127
|
-
__proto__: []
|
|
128
|
-
}, Array) && function(d, b) {
|
|
129
|
-
d.__proto__ = b;
|
|
130
|
-
} || function(d, b) {
|
|
131
|
-
for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
132
|
-
};
|
|
133
|
-
return extendStatics(d, b);
|
|
134
|
-
};
|
|
135
|
-
function __extends(d, b) {
|
|
136
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
137
|
-
extendStatics(d, b);
|
|
138
|
-
function __() {
|
|
139
|
-
this.constructor = d;
|
|
140
|
-
}
|
|
141
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
142
|
-
}
|
|
143
108
|
function __decorate(decorators, target, key, desc) {
|
|
144
109
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
145
110
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -149,763 +114,11 @@ function __decorate(decorators, target, key, desc) {
|
|
|
149
114
|
function __metadata(metadataKey, metadataValue) {
|
|
150
115
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
151
116
|
}
|
|
152
|
-
function __values(o) {
|
|
153
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
154
|
-
if (m) return m.call(o);
|
|
155
|
-
if (o && typeof o.length === "number") return {
|
|
156
|
-
next: function next() {
|
|
157
|
-
if (o && i >= o.length) o = void 0;
|
|
158
|
-
return {
|
|
159
|
-
value: o && o[i++],
|
|
160
|
-
done: !o
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
165
|
-
}
|
|
166
|
-
function __read(o, n) {
|
|
167
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
168
|
-
if (!m) return o;
|
|
169
|
-
var i = m.call(o), r, ar = [], e;
|
|
170
|
-
try {
|
|
171
|
-
while((n === void 0 || n-- > 0) && !(r = i.next()).done)ar.push(r.value);
|
|
172
|
-
} catch (error) {
|
|
173
|
-
e = {
|
|
174
|
-
error: error
|
|
175
|
-
};
|
|
176
|
-
} finally{
|
|
177
|
-
try {
|
|
178
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
179
|
-
} finally{
|
|
180
|
-
if (e) throw e.error;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return ar;
|
|
184
|
-
}
|
|
185
|
-
function __spreadArray(to, from, pack) {
|
|
186
|
-
if (pack || arguments.length === 2) for(var i = 0, l = from.length, ar; i < l; i++){
|
|
187
|
-
if (ar || !(i in from)) {
|
|
188
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
189
|
-
ar[i] = from[i];
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
193
|
-
}
|
|
194
117
|
typeof SuppressedError === "function" ? SuppressedError : function _SuppressedError(error, suppressed, message) {
|
|
195
118
|
var e = new Error(message);
|
|
196
119
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
197
120
|
};
|
|
198
121
|
|
|
199
|
-
function isFunction(value) {
|
|
200
|
-
return typeof value === "function";
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function createErrorClass(createImpl) {
|
|
204
|
-
var _super = function _super(instance) {
|
|
205
|
-
Error.call(instance);
|
|
206
|
-
instance.stack = new Error().stack;
|
|
207
|
-
};
|
|
208
|
-
var ctorFunc = createImpl(_super);
|
|
209
|
-
ctorFunc.prototype = Object.create(Error.prototype);
|
|
210
|
-
ctorFunc.prototype.constructor = ctorFunc;
|
|
211
|
-
return ctorFunc;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
var UnsubscriptionError = createErrorClass(function(_super) {
|
|
215
|
-
return function UnsubscriptionErrorImpl(errors) {
|
|
216
|
-
_super(this);
|
|
217
|
-
this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) {
|
|
218
|
-
return i + 1 + ") " + err.toString();
|
|
219
|
-
}).join("\n ") : "";
|
|
220
|
-
this.name = "UnsubscriptionError";
|
|
221
|
-
this.errors = errors;
|
|
222
|
-
};
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
function arrRemove(arr, item) {
|
|
226
|
-
if (arr) {
|
|
227
|
-
var index = arr.indexOf(item);
|
|
228
|
-
0 <= index && arr.splice(index, 1);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function _instanceof$1(left, right) {
|
|
233
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
234
|
-
return !!right[Symbol.hasInstance](left);
|
|
235
|
-
} else {
|
|
236
|
-
return left instanceof right;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
var Subscription = function() {
|
|
240
|
-
function Subscription(initialTeardown) {
|
|
241
|
-
this.initialTeardown = initialTeardown;
|
|
242
|
-
this.closed = false;
|
|
243
|
-
this._parentage = null;
|
|
244
|
-
this._finalizers = null;
|
|
245
|
-
}
|
|
246
|
-
Subscription.prototype.unsubscribe = function() {
|
|
247
|
-
var e_1, _a, e_2, _b;
|
|
248
|
-
var errors;
|
|
249
|
-
if (!this.closed) {
|
|
250
|
-
this.closed = true;
|
|
251
|
-
var _parentage = this._parentage;
|
|
252
|
-
if (_parentage) {
|
|
253
|
-
this._parentage = null;
|
|
254
|
-
if (Array.isArray(_parentage)) {
|
|
255
|
-
try {
|
|
256
|
-
for(var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()){
|
|
257
|
-
var parent_1 = _parentage_1_1.value;
|
|
258
|
-
parent_1.remove(this);
|
|
259
|
-
}
|
|
260
|
-
} catch (e_1_1) {
|
|
261
|
-
e_1 = {
|
|
262
|
-
error: e_1_1
|
|
263
|
-
};
|
|
264
|
-
} finally{
|
|
265
|
-
try {
|
|
266
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
267
|
-
} finally{
|
|
268
|
-
if (e_1) throw e_1.error;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
} else {
|
|
272
|
-
_parentage.remove(this);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
var initialFinalizer = this.initialTeardown;
|
|
276
|
-
if (isFunction(initialFinalizer)) {
|
|
277
|
-
try {
|
|
278
|
-
initialFinalizer();
|
|
279
|
-
} catch (e) {
|
|
280
|
-
errors = _instanceof$1(e, UnsubscriptionError) ? e.errors : [
|
|
281
|
-
e
|
|
282
|
-
];
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
var _finalizers = this._finalizers;
|
|
286
|
-
if (_finalizers) {
|
|
287
|
-
this._finalizers = null;
|
|
288
|
-
try {
|
|
289
|
-
for(var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()){
|
|
290
|
-
var finalizer = _finalizers_1_1.value;
|
|
291
|
-
try {
|
|
292
|
-
execFinalizer(finalizer);
|
|
293
|
-
} catch (err) {
|
|
294
|
-
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
295
|
-
if (_instanceof$1(err, UnsubscriptionError)) {
|
|
296
|
-
errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
|
|
297
|
-
} else {
|
|
298
|
-
errors.push(err);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
} catch (e_2_1) {
|
|
303
|
-
e_2 = {
|
|
304
|
-
error: e_2_1
|
|
305
|
-
};
|
|
306
|
-
} finally{
|
|
307
|
-
try {
|
|
308
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
309
|
-
} finally{
|
|
310
|
-
if (e_2) throw e_2.error;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
if (errors) {
|
|
315
|
-
throw new UnsubscriptionError(errors);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
Subscription.prototype.add = function(teardown) {
|
|
320
|
-
var _a;
|
|
321
|
-
if (teardown && teardown !== this) {
|
|
322
|
-
if (this.closed) {
|
|
323
|
-
execFinalizer(teardown);
|
|
324
|
-
} else {
|
|
325
|
-
if (_instanceof$1(teardown, Subscription)) {
|
|
326
|
-
if (teardown.closed || teardown._hasParent(this)) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
teardown._addParent(this);
|
|
330
|
-
}
|
|
331
|
-
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
Subscription.prototype._hasParent = function(parent) {
|
|
336
|
-
var _parentage = this._parentage;
|
|
337
|
-
return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
|
|
338
|
-
};
|
|
339
|
-
Subscription.prototype._addParent = function(parent) {
|
|
340
|
-
var _parentage = this._parentage;
|
|
341
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [
|
|
342
|
-
_parentage,
|
|
343
|
-
parent
|
|
344
|
-
] : parent;
|
|
345
|
-
};
|
|
346
|
-
Subscription.prototype._removeParent = function(parent) {
|
|
347
|
-
var _parentage = this._parentage;
|
|
348
|
-
if (_parentage === parent) {
|
|
349
|
-
this._parentage = null;
|
|
350
|
-
} else if (Array.isArray(_parentage)) {
|
|
351
|
-
arrRemove(_parentage, parent);
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
Subscription.prototype.remove = function(teardown) {
|
|
355
|
-
var _finalizers = this._finalizers;
|
|
356
|
-
_finalizers && arrRemove(_finalizers, teardown);
|
|
357
|
-
if (_instanceof$1(teardown, Subscription)) {
|
|
358
|
-
teardown._removeParent(this);
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
Subscription.EMPTY = function() {
|
|
362
|
-
var empty = new Subscription();
|
|
363
|
-
empty.closed = true;
|
|
364
|
-
return empty;
|
|
365
|
-
}();
|
|
366
|
-
return Subscription;
|
|
367
|
-
}();
|
|
368
|
-
var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
369
|
-
function isSubscription(value) {
|
|
370
|
-
return _instanceof$1(value, Subscription) || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
|
|
371
|
-
}
|
|
372
|
-
function execFinalizer(finalizer) {
|
|
373
|
-
if (isFunction(finalizer)) {
|
|
374
|
-
finalizer();
|
|
375
|
-
} else {
|
|
376
|
-
finalizer.unsubscribe();
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
var config = {
|
|
381
|
-
Promise: undefined};
|
|
382
|
-
|
|
383
|
-
var timeoutProvider = {
|
|
384
|
-
setTimeout: function setTimeout1(handler, timeout) {
|
|
385
|
-
var args = [];
|
|
386
|
-
for(var _i = 2; _i < arguments.length; _i++){
|
|
387
|
-
args[_i - 2] = arguments[_i];
|
|
388
|
-
}
|
|
389
|
-
return setTimeout.apply(void 0, __spreadArray([
|
|
390
|
-
handler,
|
|
391
|
-
timeout
|
|
392
|
-
], __read(args)));
|
|
393
|
-
},
|
|
394
|
-
clearTimeout: function clearTimeout1(handle) {
|
|
395
|
-
return (clearTimeout)(handle);
|
|
396
|
-
},
|
|
397
|
-
delegate: undefined
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
function reportUnhandledError(err) {
|
|
401
|
-
timeoutProvider.setTimeout(function() {
|
|
402
|
-
{
|
|
403
|
-
throw err;
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
function noop() {}
|
|
409
|
-
|
|
410
|
-
function errorContext(cb) {
|
|
411
|
-
{
|
|
412
|
-
cb();
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
var Subscriber = function(_super) {
|
|
417
|
-
__extends(Subscriber, _super);
|
|
418
|
-
function Subscriber(destination) {
|
|
419
|
-
var _this = _super.call(this) || this;
|
|
420
|
-
_this.isStopped = false;
|
|
421
|
-
if (destination) {
|
|
422
|
-
_this.destination = destination;
|
|
423
|
-
if (isSubscription(destination)) {
|
|
424
|
-
destination.add(_this);
|
|
425
|
-
}
|
|
426
|
-
} else {
|
|
427
|
-
_this.destination = EMPTY_OBSERVER;
|
|
428
|
-
}
|
|
429
|
-
return _this;
|
|
430
|
-
}
|
|
431
|
-
Subscriber.create = function(next, error, complete) {
|
|
432
|
-
return new SafeSubscriber(next, error, complete);
|
|
433
|
-
};
|
|
434
|
-
Subscriber.prototype.next = function(value) {
|
|
435
|
-
if (this.isStopped) ; else {
|
|
436
|
-
this._next(value);
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
Subscriber.prototype.error = function(err) {
|
|
440
|
-
if (this.isStopped) ; else {
|
|
441
|
-
this.isStopped = true;
|
|
442
|
-
this._error(err);
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
Subscriber.prototype.complete = function() {
|
|
446
|
-
if (this.isStopped) ; else {
|
|
447
|
-
this.isStopped = true;
|
|
448
|
-
this._complete();
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
Subscriber.prototype.unsubscribe = function() {
|
|
452
|
-
if (!this.closed) {
|
|
453
|
-
this.isStopped = true;
|
|
454
|
-
_super.prototype.unsubscribe.call(this);
|
|
455
|
-
this.destination = null;
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
Subscriber.prototype._next = function(value) {
|
|
459
|
-
this.destination.next(value);
|
|
460
|
-
};
|
|
461
|
-
Subscriber.prototype._error = function(err) {
|
|
462
|
-
try {
|
|
463
|
-
this.destination.error(err);
|
|
464
|
-
} finally{
|
|
465
|
-
this.unsubscribe();
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
Subscriber.prototype._complete = function() {
|
|
469
|
-
try {
|
|
470
|
-
this.destination.complete();
|
|
471
|
-
} finally{
|
|
472
|
-
this.unsubscribe();
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
return Subscriber;
|
|
476
|
-
}(Subscription);
|
|
477
|
-
var ConsumerObserver = function() {
|
|
478
|
-
function ConsumerObserver(partialObserver) {
|
|
479
|
-
this.partialObserver = partialObserver;
|
|
480
|
-
}
|
|
481
|
-
ConsumerObserver.prototype.next = function(value) {
|
|
482
|
-
var partialObserver = this.partialObserver;
|
|
483
|
-
if (partialObserver.next) {
|
|
484
|
-
try {
|
|
485
|
-
partialObserver.next(value);
|
|
486
|
-
} catch (error) {
|
|
487
|
-
handleUnhandledError(error);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
};
|
|
491
|
-
ConsumerObserver.prototype.error = function(err) {
|
|
492
|
-
var partialObserver = this.partialObserver;
|
|
493
|
-
if (partialObserver.error) {
|
|
494
|
-
try {
|
|
495
|
-
partialObserver.error(err);
|
|
496
|
-
} catch (error) {
|
|
497
|
-
handleUnhandledError(error);
|
|
498
|
-
}
|
|
499
|
-
} else {
|
|
500
|
-
handleUnhandledError(err);
|
|
501
|
-
}
|
|
502
|
-
};
|
|
503
|
-
ConsumerObserver.prototype.complete = function() {
|
|
504
|
-
var partialObserver = this.partialObserver;
|
|
505
|
-
if (partialObserver.complete) {
|
|
506
|
-
try {
|
|
507
|
-
partialObserver.complete();
|
|
508
|
-
} catch (error) {
|
|
509
|
-
handleUnhandledError(error);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
return ConsumerObserver;
|
|
514
|
-
}();
|
|
515
|
-
var SafeSubscriber = function(_super) {
|
|
516
|
-
__extends(SafeSubscriber, _super);
|
|
517
|
-
function SafeSubscriber(observerOrNext, error, complete) {
|
|
518
|
-
var _this = _super.call(this) || this;
|
|
519
|
-
var partialObserver;
|
|
520
|
-
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
521
|
-
partialObserver = {
|
|
522
|
-
next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
|
|
523
|
-
error: error !== null && error !== void 0 ? error : undefined,
|
|
524
|
-
complete: complete !== null && complete !== void 0 ? complete : undefined
|
|
525
|
-
};
|
|
526
|
-
} else {
|
|
527
|
-
{
|
|
528
|
-
partialObserver = observerOrNext;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
_this.destination = new ConsumerObserver(partialObserver);
|
|
532
|
-
return _this;
|
|
533
|
-
}
|
|
534
|
-
return SafeSubscriber;
|
|
535
|
-
}(Subscriber);
|
|
536
|
-
function handleUnhandledError(error) {
|
|
537
|
-
{
|
|
538
|
-
reportUnhandledError(error);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
function defaultErrorHandler(err) {
|
|
542
|
-
throw err;
|
|
543
|
-
}
|
|
544
|
-
var EMPTY_OBSERVER = {
|
|
545
|
-
closed: true,
|
|
546
|
-
next: noop,
|
|
547
|
-
error: defaultErrorHandler,
|
|
548
|
-
complete: noop
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
var observable = function() {
|
|
552
|
-
return typeof Symbol === "function" && Symbol.observable || "@@observable";
|
|
553
|
-
}();
|
|
554
|
-
|
|
555
|
-
function identity(x) {
|
|
556
|
-
return x;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
function pipeFromArray(fns) {
|
|
560
|
-
if (fns.length === 0) {
|
|
561
|
-
return identity;
|
|
562
|
-
}
|
|
563
|
-
if (fns.length === 1) {
|
|
564
|
-
return fns[0];
|
|
565
|
-
}
|
|
566
|
-
return function piped(input) {
|
|
567
|
-
return fns.reduce(function(prev, fn) {
|
|
568
|
-
return fn(prev);
|
|
569
|
-
}, input);
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
function _instanceof(left, right) {
|
|
574
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
575
|
-
return !!right[Symbol.hasInstance](left);
|
|
576
|
-
} else {
|
|
577
|
-
return left instanceof right;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
var Observable = function() {
|
|
581
|
-
function Observable(subscribe) {
|
|
582
|
-
if (subscribe) {
|
|
583
|
-
this._subscribe = subscribe;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
Observable.prototype.lift = function(operator) {
|
|
587
|
-
var observable = new Observable();
|
|
588
|
-
observable.source = this;
|
|
589
|
-
observable.operator = operator;
|
|
590
|
-
return observable;
|
|
591
|
-
};
|
|
592
|
-
Observable.prototype.subscribe = function(observerOrNext, error, complete) {
|
|
593
|
-
var _this = this;
|
|
594
|
-
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
595
|
-
errorContext(function() {
|
|
596
|
-
var _a = _this, operator = _a.operator, source = _a.source;
|
|
597
|
-
subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
|
|
598
|
-
});
|
|
599
|
-
return subscriber;
|
|
600
|
-
};
|
|
601
|
-
Observable.prototype._trySubscribe = function(sink) {
|
|
602
|
-
try {
|
|
603
|
-
return this._subscribe(sink);
|
|
604
|
-
} catch (err) {
|
|
605
|
-
sink.error(err);
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
Observable.prototype.forEach = function(next, promiseCtor) {
|
|
609
|
-
var _this = this;
|
|
610
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
611
|
-
return new promiseCtor(function(resolve, reject) {
|
|
612
|
-
var subscriber = new SafeSubscriber({
|
|
613
|
-
next: function next1(value) {
|
|
614
|
-
try {
|
|
615
|
-
next(value);
|
|
616
|
-
} catch (err) {
|
|
617
|
-
reject(err);
|
|
618
|
-
subscriber.unsubscribe();
|
|
619
|
-
}
|
|
620
|
-
},
|
|
621
|
-
error: reject,
|
|
622
|
-
complete: resolve
|
|
623
|
-
});
|
|
624
|
-
_this.subscribe(subscriber);
|
|
625
|
-
});
|
|
626
|
-
};
|
|
627
|
-
Observable.prototype._subscribe = function(subscriber) {
|
|
628
|
-
var _a;
|
|
629
|
-
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
630
|
-
};
|
|
631
|
-
Observable.prototype[observable] = function() {
|
|
632
|
-
return this;
|
|
633
|
-
};
|
|
634
|
-
Observable.prototype.pipe = function() {
|
|
635
|
-
var operations = [];
|
|
636
|
-
for(var _i = 0; _i < arguments.length; _i++){
|
|
637
|
-
operations[_i] = arguments[_i];
|
|
638
|
-
}
|
|
639
|
-
return pipeFromArray(operations)(this);
|
|
640
|
-
};
|
|
641
|
-
Observable.prototype.toPromise = function(promiseCtor) {
|
|
642
|
-
var _this = this;
|
|
643
|
-
promiseCtor = getPromiseCtor(promiseCtor);
|
|
644
|
-
return new promiseCtor(function(resolve, reject) {
|
|
645
|
-
var value;
|
|
646
|
-
_this.subscribe(function(x) {
|
|
647
|
-
return value = x;
|
|
648
|
-
}, function(err) {
|
|
649
|
-
return reject(err);
|
|
650
|
-
}, function() {
|
|
651
|
-
return resolve(value);
|
|
652
|
-
});
|
|
653
|
-
});
|
|
654
|
-
};
|
|
655
|
-
Observable.create = function(subscribe) {
|
|
656
|
-
return new Observable(subscribe);
|
|
657
|
-
};
|
|
658
|
-
return Observable;
|
|
659
|
-
}();
|
|
660
|
-
function getPromiseCtor(promiseCtor) {
|
|
661
|
-
var _a;
|
|
662
|
-
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
663
|
-
}
|
|
664
|
-
function isObserver(value) {
|
|
665
|
-
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
666
|
-
}
|
|
667
|
-
function isSubscriber(value) {
|
|
668
|
-
return value && _instanceof(value, Subscriber) || isObserver(value) && isSubscription(value);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
function hasLift(source) {
|
|
672
|
-
return isFunction(source === null || source === void 0 ? void 0 : source.lift);
|
|
673
|
-
}
|
|
674
|
-
function operate(init) {
|
|
675
|
-
return function(source) {
|
|
676
|
-
if (hasLift(source)) {
|
|
677
|
-
return source.lift(function(liftedSource) {
|
|
678
|
-
try {
|
|
679
|
-
return init(liftedSource, this);
|
|
680
|
-
} catch (err) {
|
|
681
|
-
this.error(err);
|
|
682
|
-
}
|
|
683
|
-
});
|
|
684
|
-
}
|
|
685
|
-
throw new TypeError("Unable to lift unknown Observable type");
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
|
|
690
|
-
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
|
|
691
|
-
}
|
|
692
|
-
var OperatorSubscriber = function(_super) {
|
|
693
|
-
__extends(OperatorSubscriber, _super);
|
|
694
|
-
function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
|
|
695
|
-
var _this = _super.call(this, destination) || this;
|
|
696
|
-
_this.onFinalize = onFinalize;
|
|
697
|
-
_this.shouldUnsubscribe = shouldUnsubscribe;
|
|
698
|
-
_this._next = onNext ? function(value) {
|
|
699
|
-
try {
|
|
700
|
-
onNext(value);
|
|
701
|
-
} catch (err) {
|
|
702
|
-
destination.error(err);
|
|
703
|
-
}
|
|
704
|
-
} : _super.prototype._next;
|
|
705
|
-
_this._error = onError ? function(err) {
|
|
706
|
-
try {
|
|
707
|
-
onError(err);
|
|
708
|
-
} catch (err) {
|
|
709
|
-
destination.error(err);
|
|
710
|
-
} finally{
|
|
711
|
-
this.unsubscribe();
|
|
712
|
-
}
|
|
713
|
-
} : _super.prototype._error;
|
|
714
|
-
_this._complete = onComplete ? function() {
|
|
715
|
-
try {
|
|
716
|
-
onComplete();
|
|
717
|
-
} catch (err) {
|
|
718
|
-
destination.error(err);
|
|
719
|
-
} finally{
|
|
720
|
-
this.unsubscribe();
|
|
721
|
-
}
|
|
722
|
-
} : _super.prototype._complete;
|
|
723
|
-
return _this;
|
|
724
|
-
}
|
|
725
|
-
OperatorSubscriber.prototype.unsubscribe = function() {
|
|
726
|
-
var _a;
|
|
727
|
-
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
|
|
728
|
-
var closed_1 = this.closed;
|
|
729
|
-
_super.prototype.unsubscribe.call(this);
|
|
730
|
-
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
return OperatorSubscriber;
|
|
734
|
-
}(Subscriber);
|
|
735
|
-
|
|
736
|
-
var ObjectUnsubscribedError = createErrorClass(function(_super) {
|
|
737
|
-
return function ObjectUnsubscribedErrorImpl() {
|
|
738
|
-
_super(this);
|
|
739
|
-
this.name = "ObjectUnsubscribedError";
|
|
740
|
-
this.message = "object unsubscribed";
|
|
741
|
-
};
|
|
742
|
-
});
|
|
743
|
-
|
|
744
|
-
var Subject = function(_super) {
|
|
745
|
-
__extends(Subject, _super);
|
|
746
|
-
function Subject() {
|
|
747
|
-
var _this = _super.call(this) || this;
|
|
748
|
-
_this.closed = false;
|
|
749
|
-
_this.currentObservers = null;
|
|
750
|
-
_this.observers = [];
|
|
751
|
-
_this.isStopped = false;
|
|
752
|
-
_this.hasError = false;
|
|
753
|
-
_this.thrownError = null;
|
|
754
|
-
return _this;
|
|
755
|
-
}
|
|
756
|
-
Subject.prototype.lift = function(operator) {
|
|
757
|
-
var subject = new AnonymousSubject(this, this);
|
|
758
|
-
subject.operator = operator;
|
|
759
|
-
return subject;
|
|
760
|
-
};
|
|
761
|
-
Subject.prototype._throwIfClosed = function() {
|
|
762
|
-
if (this.closed) {
|
|
763
|
-
throw new ObjectUnsubscribedError();
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
Subject.prototype.next = function(value) {
|
|
767
|
-
var _this = this;
|
|
768
|
-
errorContext(function() {
|
|
769
|
-
var e_1, _a;
|
|
770
|
-
_this._throwIfClosed();
|
|
771
|
-
if (!_this.isStopped) {
|
|
772
|
-
if (!_this.currentObservers) {
|
|
773
|
-
_this.currentObservers = Array.from(_this.observers);
|
|
774
|
-
}
|
|
775
|
-
try {
|
|
776
|
-
for(var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()){
|
|
777
|
-
var observer = _c.value;
|
|
778
|
-
observer.next(value);
|
|
779
|
-
}
|
|
780
|
-
} catch (e_1_1) {
|
|
781
|
-
e_1 = {
|
|
782
|
-
error: e_1_1
|
|
783
|
-
};
|
|
784
|
-
} finally{
|
|
785
|
-
try {
|
|
786
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
787
|
-
} finally{
|
|
788
|
-
if (e_1) throw e_1.error;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
});
|
|
793
|
-
};
|
|
794
|
-
Subject.prototype.error = function(err) {
|
|
795
|
-
var _this = this;
|
|
796
|
-
errorContext(function() {
|
|
797
|
-
_this._throwIfClosed();
|
|
798
|
-
if (!_this.isStopped) {
|
|
799
|
-
_this.hasError = _this.isStopped = true;
|
|
800
|
-
_this.thrownError = err;
|
|
801
|
-
var observers = _this.observers;
|
|
802
|
-
while(observers.length){
|
|
803
|
-
observers.shift().error(err);
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
});
|
|
807
|
-
};
|
|
808
|
-
Subject.prototype.complete = function() {
|
|
809
|
-
var _this = this;
|
|
810
|
-
errorContext(function() {
|
|
811
|
-
_this._throwIfClosed();
|
|
812
|
-
if (!_this.isStopped) {
|
|
813
|
-
_this.isStopped = true;
|
|
814
|
-
var observers = _this.observers;
|
|
815
|
-
while(observers.length){
|
|
816
|
-
observers.shift().complete();
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
});
|
|
820
|
-
};
|
|
821
|
-
Subject.prototype.unsubscribe = function() {
|
|
822
|
-
this.isStopped = this.closed = true;
|
|
823
|
-
this.observers = this.currentObservers = null;
|
|
824
|
-
};
|
|
825
|
-
Object.defineProperty(Subject.prototype, "observed", {
|
|
826
|
-
get: function get() {
|
|
827
|
-
var _a;
|
|
828
|
-
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
829
|
-
},
|
|
830
|
-
enumerable: false,
|
|
831
|
-
configurable: true
|
|
832
|
-
});
|
|
833
|
-
Subject.prototype._trySubscribe = function(subscriber) {
|
|
834
|
-
this._throwIfClosed();
|
|
835
|
-
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
836
|
-
};
|
|
837
|
-
Subject.prototype._subscribe = function(subscriber) {
|
|
838
|
-
this._throwIfClosed();
|
|
839
|
-
this._checkFinalizedStatuses(subscriber);
|
|
840
|
-
return this._innerSubscribe(subscriber);
|
|
841
|
-
};
|
|
842
|
-
Subject.prototype._innerSubscribe = function(subscriber) {
|
|
843
|
-
var _this = this;
|
|
844
|
-
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
|
|
845
|
-
if (hasError || isStopped) {
|
|
846
|
-
return EMPTY_SUBSCRIPTION;
|
|
847
|
-
}
|
|
848
|
-
this.currentObservers = null;
|
|
849
|
-
observers.push(subscriber);
|
|
850
|
-
return new Subscription(function() {
|
|
851
|
-
_this.currentObservers = null;
|
|
852
|
-
arrRemove(observers, subscriber);
|
|
853
|
-
});
|
|
854
|
-
};
|
|
855
|
-
Subject.prototype._checkFinalizedStatuses = function(subscriber) {
|
|
856
|
-
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
|
|
857
|
-
if (hasError) {
|
|
858
|
-
subscriber.error(thrownError);
|
|
859
|
-
} else if (isStopped) {
|
|
860
|
-
subscriber.complete();
|
|
861
|
-
}
|
|
862
|
-
};
|
|
863
|
-
Subject.prototype.asObservable = function() {
|
|
864
|
-
var observable = new Observable();
|
|
865
|
-
observable.source = this;
|
|
866
|
-
return observable;
|
|
867
|
-
};
|
|
868
|
-
Subject.create = function(destination, source) {
|
|
869
|
-
return new AnonymousSubject(destination, source);
|
|
870
|
-
};
|
|
871
|
-
return Subject;
|
|
872
|
-
}(Observable);
|
|
873
|
-
var AnonymousSubject = function(_super) {
|
|
874
|
-
__extends(AnonymousSubject, _super);
|
|
875
|
-
function AnonymousSubject(destination, source) {
|
|
876
|
-
var _this = _super.call(this) || this;
|
|
877
|
-
_this.destination = destination;
|
|
878
|
-
_this.source = source;
|
|
879
|
-
return _this;
|
|
880
|
-
}
|
|
881
|
-
AnonymousSubject.prototype.next = function(value) {
|
|
882
|
-
var _a, _b;
|
|
883
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
884
|
-
};
|
|
885
|
-
AnonymousSubject.prototype.error = function(err) {
|
|
886
|
-
var _a, _b;
|
|
887
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
|
|
888
|
-
};
|
|
889
|
-
AnonymousSubject.prototype.complete = function() {
|
|
890
|
-
var _a, _b;
|
|
891
|
-
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
892
|
-
};
|
|
893
|
-
AnonymousSubject.prototype._subscribe = function(subscriber) {
|
|
894
|
-
var _a, _b;
|
|
895
|
-
return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
|
|
896
|
-
};
|
|
897
|
-
return AnonymousSubject;
|
|
898
|
-
}(Subject);
|
|
899
|
-
|
|
900
|
-
function filter(predicate, thisArg) {
|
|
901
|
-
return operate(function(source, subscriber) {
|
|
902
|
-
var index = 0;
|
|
903
|
-
source.subscribe(createOperatorSubscriber(subscriber, function(value) {
|
|
904
|
-
return predicate.call(thisArg, value, index++) && subscriber.next(value);
|
|
905
|
-
}));
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
|
|
909
122
|
// request-context.ts
|
|
910
123
|
class RequestContext {
|
|
911
124
|
static currentRequestContext() {
|
|
@@ -1149,7 +362,6 @@ StrategyBus = __decorate([
|
|
|
1149
362
|
class BaseStrategyRegistry {
|
|
1150
363
|
onModuleInit() {
|
|
1151
364
|
this.bus.events$.pipe(filter((event)=>!event.strategyType || event.strategyType === this.strategyKey)).subscribe((evt)=>{
|
|
1152
|
-
this.logger.debug(`Received strategy bus event: ${JSON.stringify(evt)}`);
|
|
1153
365
|
if (evt.type === 'UPSERT') {
|
|
1154
366
|
this.upsert(evt.entry.instance);
|
|
1155
367
|
} else if (evt.type === 'REMOVE') {
|
|
@@ -1798,6 +1010,28 @@ function getErrorMessage(err) {
|
|
|
1798
1010
|
}
|
|
1799
1011
|
return error;
|
|
1800
1012
|
}
|
|
1013
|
+
class JsonSchemaValidator {
|
|
1014
|
+
parseAndValidate(schemaStr) {
|
|
1015
|
+
if (!schemaStr) return undefined;
|
|
1016
|
+
let schema;
|
|
1017
|
+
try {
|
|
1018
|
+
schema = JSON.parse(schemaStr);
|
|
1019
|
+
} catch (e) {
|
|
1020
|
+
throw new Error('Schema is not valid JSON');
|
|
1021
|
+
}
|
|
1022
|
+
const validate = this.ajv.getSchema(schemaDraft04.$id);
|
|
1023
|
+
if (!validate(schema)) {
|
|
1024
|
+
throw new Error('Invalid JSON Schema: ' + this.ajv.errorsText(validate.errors));
|
|
1025
|
+
}
|
|
1026
|
+
return schema;
|
|
1027
|
+
}
|
|
1028
|
+
constructor(){
|
|
1029
|
+
this.ajv = new Ajv({
|
|
1030
|
+
strict: false
|
|
1031
|
+
});
|
|
1032
|
+
this.ajv.addMetaSchema(schemaDraft04);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1801
1035
|
|
|
1802
1036
|
const DATASOURCE_STRATEGY = 'DATASOURCE_STRATEGY';
|
|
1803
1037
|
const DataSourceStrategy = (provider)=>applyDecorators(SetMetadata(DATASOURCE_STRATEGY, provider), SetMetadata(STRATEGY_META_KEY, DATASOURCE_STRATEGY));
|
|
@@ -2405,6 +1639,46 @@ const PARAMETER_RULE_TEMPLATE = {
|
|
|
2405
1639
|
}
|
|
2406
1640
|
};
|
|
2407
1641
|
|
|
1642
|
+
const CommonParameterRules = [
|
|
1643
|
+
{
|
|
1644
|
+
name: 'temperature',
|
|
1645
|
+
label: {
|
|
1646
|
+
zh_Hans: '温度',
|
|
1647
|
+
en_US: `Temperature`
|
|
1648
|
+
},
|
|
1649
|
+
type: ParameterType.FLOAT,
|
|
1650
|
+
help: {
|
|
1651
|
+
zh_Hans: '控制模型输出的随机性。较高的值(例如 1.0)使响应更具创意,而较低的值(例如 0.1)使响应更具确定性和重点性。',
|
|
1652
|
+
en_US: `Controls the randomness of the model's output. A higher value (e.g., 1.0) makes responses more creative, while a lower value (e.g., 0.1) makes them more deterministic and focused.`
|
|
1653
|
+
},
|
|
1654
|
+
required: false,
|
|
1655
|
+
default: 0.2,
|
|
1656
|
+
min: 0,
|
|
1657
|
+
max: 1,
|
|
1658
|
+
precision: 0.1
|
|
1659
|
+
},
|
|
1660
|
+
{
|
|
1661
|
+
label: {
|
|
1662
|
+
zh_Hans: '最大尝试次数',
|
|
1663
|
+
en_US: 'The maximum number of attempts'
|
|
1664
|
+
},
|
|
1665
|
+
type: ParameterType.INT,
|
|
1666
|
+
help: {
|
|
1667
|
+
zh_Hans: '如果请求由于网络超时或速率限制等问题而失败,系统将尝试重新发送请求的最大次数',
|
|
1668
|
+
en_US: 'The maximum number of attempts the system will make to resend a request if it fails due to issues like network timeouts or rate limits'
|
|
1669
|
+
},
|
|
1670
|
+
required: false,
|
|
1671
|
+
default: 6,
|
|
1672
|
+
min: 0,
|
|
1673
|
+
max: 10,
|
|
1674
|
+
precision: 0,
|
|
1675
|
+
name: 'maxRetries'
|
|
1676
|
+
}
|
|
1677
|
+
];
|
|
1678
|
+
function mergeCredentials(credentials, modelProperties) {
|
|
1679
|
+
return _extends({}, credentials != null ? credentials : {}, modelProperties != null ? modelProperties : {});
|
|
1680
|
+
}
|
|
1681
|
+
|
|
2408
1682
|
let AIModel = class AIModel {
|
|
2409
1683
|
getChatModel(copilotModel, options) {
|
|
2410
1684
|
throw new Error(`Unsupport chat model!`);
|
|
@@ -2548,6 +1822,15 @@ let AIModel = class AIModel {
|
|
|
2548
1822
|
...parameterRules.filter((_)=>!CommonParameterRules.some((r)=>r.name === _.name))
|
|
2549
1823
|
];
|
|
2550
1824
|
}
|
|
1825
|
+
getModelProfile(model, credentials) {
|
|
1826
|
+
var _modelSchema_model_properties, _modelSchema_features, _modelSchema_features1, _modelSchema_features2, _modelSchema_features3;
|
|
1827
|
+
const modelSchema = this.getModelSchema(model, credentials);
|
|
1828
|
+
return modelSchema && {
|
|
1829
|
+
maxInputTokens: (_modelSchema_model_properties = modelSchema.model_properties) == null ? void 0 : _modelSchema_model_properties.context_size,
|
|
1830
|
+
toolCalling: ((_modelSchema_features = modelSchema.features) == null ? void 0 : _modelSchema_features.includes(ModelFeature.TOOL_CALL)) || ((_modelSchema_features1 = modelSchema.features) == null ? void 0 : _modelSchema_features1.includes(ModelFeature.MULTI_TOOL_CALL)) || ((_modelSchema_features2 = modelSchema.features) == null ? void 0 : _modelSchema_features2.includes(ModelFeature.STREAM_TOOL_CALL)),
|
|
1831
|
+
structuredOutput: (_modelSchema_features3 = modelSchema.features) == null ? void 0 : _modelSchema_features3.includes(ModelFeature.STRUCTURED_OUTPUT)
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
2551
1834
|
constructor(modelProvider, modelType){
|
|
2552
1835
|
this.modelProvider = modelProvider;
|
|
2553
1836
|
this.modelType = modelType;
|
|
@@ -2587,46 +1870,6 @@ class RerankModel extends AIModel {
|
|
|
2587
1870
|
}
|
|
2588
1871
|
}
|
|
2589
1872
|
|
|
2590
|
-
const CommonParameterRules = [
|
|
2591
|
-
{
|
|
2592
|
-
name: 'temperature',
|
|
2593
|
-
label: {
|
|
2594
|
-
zh_Hans: '温度',
|
|
2595
|
-
en_US: `Temperature`
|
|
2596
|
-
},
|
|
2597
|
-
type: ParameterType.FLOAT,
|
|
2598
|
-
help: {
|
|
2599
|
-
zh_Hans: '控制模型输出的随机性。较高的值(例如 1.0)使响应更具创意,而较低的值(例如 0.1)使响应更具确定性和重点性。',
|
|
2600
|
-
en_US: `Controls the randomness of the model's output. A higher value (e.g., 1.0) makes responses more creative, while a lower value (e.g., 0.1) makes them more deterministic and focused.`
|
|
2601
|
-
},
|
|
2602
|
-
required: false,
|
|
2603
|
-
default: 0.2,
|
|
2604
|
-
min: 0,
|
|
2605
|
-
max: 1,
|
|
2606
|
-
precision: 0.1
|
|
2607
|
-
},
|
|
2608
|
-
{
|
|
2609
|
-
label: {
|
|
2610
|
-
zh_Hans: '最大尝试次数',
|
|
2611
|
-
en_US: 'The maximum number of attempts'
|
|
2612
|
-
},
|
|
2613
|
-
type: ParameterType.INT,
|
|
2614
|
-
help: {
|
|
2615
|
-
zh_Hans: '如果请求由于网络超时或速率限制等问题而失败,系统将尝试重新发送请求的最大次数',
|
|
2616
|
-
en_US: 'The maximum number of attempts the system will make to resend a request if it fails due to issues like network timeouts or rate limits'
|
|
2617
|
-
},
|
|
2618
|
-
required: false,
|
|
2619
|
-
default: 6,
|
|
2620
|
-
min: 0,
|
|
2621
|
-
max: 10,
|
|
2622
|
-
precision: 0,
|
|
2623
|
-
name: 'maxRetries'
|
|
2624
|
-
}
|
|
2625
|
-
];
|
|
2626
|
-
function mergeCredentials(credentials, modelProperties) {
|
|
2627
|
-
return _extends({}, credentials != null ? credentials : {}, modelProperties != null ? modelProperties : {});
|
|
2628
|
-
}
|
|
2629
|
-
|
|
2630
1873
|
class SpeechToTextModel extends AIModel {
|
|
2631
1874
|
}
|
|
2632
1875
|
|
|
@@ -2953,7 +2196,7 @@ class OpenAICompatibleReranker {
|
|
|
2953
2196
|
if (!Array.isArray(output)) {
|
|
2954
2197
|
throw new Error('Invalid response format: missing results array');
|
|
2955
2198
|
}
|
|
2956
|
-
//
|
|
2199
|
+
// Collect raw scores and normalize them.
|
|
2957
2200
|
const scores = output.map((r)=>r.relevance_score);
|
|
2958
2201
|
const minScore = Math.min(...scores);
|
|
2959
2202
|
const maxScore = Math.max(...scores);
|
|
@@ -3056,4 +2299,4 @@ AgentMiddlewareRegistry = __decorate([
|
|
|
3056
2299
|
"end"
|
|
3057
2300
|
];
|
|
3058
2301
|
|
|
3059
|
-
export { AGENT_MIDDLEWARE_STRATEGY, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseStrategyRegistry, BaseTool, BaseToolset, BuiltinToolset, ChatOAICompatReasoningModel, CommonParameterRules, CreateModelClientCommand, CredentialsValidateFailedError, DATASOURCE_STRATEGY, DBCreateTableMode, DBProtocolEnum, DBSyntaxEnum, DBTableAction, DBTableDataAction, DOCUMENT_SOURCE_STRATEGY, DOCUMENT_TRANSFORMER_STRATEGY, DataSourceStrategy, DataSourceStrategyRegistry, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, GLOBAL_ORGANIZATION_SCOPE, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_STRATEGY, ImageUnderstandingRegistry, ImageUnderstandingStrategy, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, KNOWLEDGE_STRATEGY, KnowledgeStrategyKey, KnowledgeStrategyRegistry, LLMUsage, LargeLanguageModel, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RerankModel, RetrieverRegistry, RetrieverStrategy, STRATEGY_META_KEY, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, VECTOR_STORE_STRATEGY, VectorStoreRegistry, VectorStoreStrategy, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WrapWorkflowNodeExecutionCommand, XpFileSystem, XpertServerPlugin, als, calcTokenUsage, countTokensSafe, createI18nInstance, createPluginLogger, downloadRemoteFile, getErrorMessage, getPositionList, getPositionMap, getRequestContext, isRemoteFile, loadYamlFile, mergeCredentials, mergeParentChildChunks, runWithRequestContext, sumTokenUsage };
|
|
2302
|
+
export { AGENT_MIDDLEWARE_STRATEGY, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseStrategyRegistry, BaseTool, BaseToolset, BuiltinToolset, ChatOAICompatReasoningModel, CommonParameterRules, CreateModelClientCommand, CredentialsValidateFailedError, DATASOURCE_STRATEGY, DBCreateTableMode, DBProtocolEnum, DBSyntaxEnum, DBTableAction, DBTableDataAction, DOCUMENT_SOURCE_STRATEGY, DOCUMENT_TRANSFORMER_STRATEGY, DataSourceStrategy, DataSourceStrategyRegistry, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, GLOBAL_ORGANIZATION_SCOPE, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_STRATEGY, ImageUnderstandingRegistry, ImageUnderstandingStrategy, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KNOWLEDGE_STRATEGY, KnowledgeStrategyKey, KnowledgeStrategyRegistry, LLMUsage, LargeLanguageModel, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RerankModel, RetrieverRegistry, RetrieverStrategy, STRATEGY_META_KEY, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, VECTOR_STORE_STRATEGY, VectorStoreRegistry, VectorStoreStrategy, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WrapWorkflowNodeExecutionCommand, XpFileSystem, XpertServerPlugin, als, calcTokenUsage, countTokensSafe, createI18nInstance, createPluginLogger, downloadRemoteFile, getErrorMessage, getPositionList, getPositionMap, getRequestContext, isRemoteFile, loadYamlFile, mergeCredentials, mergeParentChildChunks, runWithRequestContext, sumTokenUsage };
|