@onereach/idw-init-account-resources 0.13.0 → 0.14.1
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/assets/db_migrations/20250401092323-datasource-search-order.js +65 -0
- package/dist/assets/db_migrations/20250401092323-datasource-search-order.js.map +1 -0
- package/dist/assets/models/datasources.js +17 -2
- package/dist/assets/models/datasources.js.map +1 -1
- package/dist/assets/models/models.js +0 -4
- package/dist/assets/models/models.js.map +1 -1
- package/dist/initializers/lookup/lookup.js +83 -26
- package/dist/initializers/lookup/lookup.js.map +1 -1
- package/dist/initializers/rdb.js +3 -3
- package/dist/initializers/rdb.js.map +1 -1
- package/package.json +2 -2
- package/src/assets/db_migrations/20250401092323-datasource-search-order.ts +23 -0
- package/src/assets/models/datasources.ts +17 -2
- package/src/assets/models/models.ts +0 -23
- package/src/initializers/lookup/lookup.ts +44 -1
- package/src/initializers/rdb.ts +2 -2
- package/src/types.ts +1 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
WARN Issue while reading "/builds/onereach/platform/idw/idw-template/.npmrc". Failed to replace env in config: ${OR_NPM_TOKEN}
|
|
2
2
|
|
|
3
|
-
> @onereach/idw-init-account-resources@0.
|
|
3
|
+
> @onereach/idw-init-account-resources@0.14.0 build /builds/onereach/platform/idw/idw-template/packages/init/idw-init-account-resources
|
|
4
4
|
> rimraf dist && tsc -b && mkdir dist/assets/skills/documentation && cp -r src/assets/skills/documentation/* dist/assets/skills/documentation
|
|
5
5
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @onereach/idw-init-account-resources
|
|
2
2
|
|
|
3
|
+
## 0.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4e42ca4: fix: use search order in datasources
|
|
8
|
+
|
|
9
|
+
## 0.14.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 0706686: add authorId migration for documents
|
|
14
|
+
|
|
3
15
|
## 0.13.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
module.exports = {
|
|
40
|
+
up: function (queryInterface) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
+
return __generator(this, function (_a) {
|
|
43
|
+
switch (_a.label) {
|
|
44
|
+
case 0: return [4, queryInterface.sequelize.query("\n ALTER TABLE models\n DROP COLUMN IF EXISTS search_order,\n DROP COLUMN IF EXISTS parent_model_id;\n\n ALTER TABLE datasources\n ADD COLUMN IF NOT EXISTS search_order SMALLINT DEFAULT 1;\n ")];
|
|
45
|
+
case 1:
|
|
46
|
+
_a.sent();
|
|
47
|
+
return [2];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
down: function (queryInterface) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
switch (_a.label) {
|
|
56
|
+
case 0: return [4, queryInterface.sequelize.query('ALTER TABLE datasources DROP COLUMN IF EXISTS search_order;')];
|
|
57
|
+
case 1:
|
|
58
|
+
_a.sent();
|
|
59
|
+
return [2];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=20250401092323-datasource-search-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20250401092323-datasource-search-order.js","sourceRoot":"","sources":["../../../src/assets/db_migrations/20250401092323-datasource-search-order.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKb,MAAM,CAAC,OAAO,GAAG;IACT,EAAE,YAAC,cAAoE;;;;4BAC3E,WAAM,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,6NAOpC,CAAC,EAAA;;wBAPF,SAOE,CAAC;;;;;KACJ;IAEK,IAAI,YAAC,cAAwE;;;;4BACjF,WAAM,cAAc,CAAC,SAAS,CAAC,KAAK,CAClC,6DAA6D,CAC9D,EAAA;;wBAFD,SAEC,CAAC;;;;;KACH;CACF,CAAC"}
|
|
@@ -17,6 +17,7 @@ var knowledge = {
|
|
|
17
17
|
answerPrompt: 'You are a helpful assistant. Generate answer on behalf of group of people who work for the company.\nAnswer has to use ONLY information strictly from provided Context. If you can`t answer the question using Context\nor the information from provided Context is not enough to answer the question, return not found. Try to save\noriginal formatting of Context, so if there is a list in Context, your answer may also contain a list. Provide\nan answer as detailed as possible. Generate the answer in original language.\n\nContext:{context}\nQuestion:{question}\nHelpful Answer:',
|
|
18
18
|
questionPrompt: 'Generate a Standalone question using the original language that accurately rephrases the Follow Up Input. However,\nif the Follow Up Input is unrelated to the chat history or if there is no chat history available, the Follow Up\nInput should be returned unchanged, without rephrasing.\n\nChat History:{chat_history}\nFollow Up Input:{question}\nStandalone question:',
|
|
19
19
|
},
|
|
20
|
+
search_order: 1,
|
|
20
21
|
};
|
|
21
22
|
var skills = {
|
|
22
23
|
name: 'Skills',
|
|
@@ -24,20 +25,32 @@ var skills = {
|
|
|
24
25
|
config: {
|
|
25
26
|
icon: null,
|
|
26
27
|
config: {
|
|
27
|
-
distance: 0.
|
|
28
|
+
distance: 0.25,
|
|
28
29
|
limit: 5,
|
|
30
|
+
chunkSize: 10,
|
|
31
|
+
provider: 'openai',
|
|
32
|
+
model: 'gpt-4o-mini',
|
|
33
|
+
temperature: 0,
|
|
34
|
+
maxTokens: 2048,
|
|
35
|
+
historyCapacity: 10,
|
|
36
|
+
frequencyPenalty: 0,
|
|
37
|
+
presencePenalty: 0,
|
|
38
|
+
stop: null,
|
|
39
|
+
topP: 1,
|
|
40
|
+
n: 1,
|
|
29
41
|
},
|
|
30
42
|
},
|
|
31
43
|
display_order: 50,
|
|
44
|
+
search_order: 1,
|
|
32
45
|
};
|
|
33
46
|
var gpt = {
|
|
34
47
|
name: 'GPT',
|
|
35
48
|
slug: 'gpt',
|
|
36
49
|
icon_url: 'https://static.vecteezy.com/system/resources/previews/022/227/367/large_2x/openai-chatgpt-logo-icon-free-png.png',
|
|
37
50
|
config: {
|
|
51
|
+
provider: 'openai',
|
|
38
52
|
model: 'gpt-4o-mini',
|
|
39
53
|
temperature: 0.4,
|
|
40
|
-
distance: 0.23,
|
|
41
54
|
maxTokens: 2048,
|
|
42
55
|
historyCapacity: 10,
|
|
43
56
|
frequencyPenalty: 0,
|
|
@@ -47,6 +60,7 @@ var gpt = {
|
|
|
47
60
|
n: 1,
|
|
48
61
|
systemPrompt: 'You are an AI assistant designed by the company OneReach.ai, to help the user achieve their goals. Your main function is to assist with tasks related to: ${ idw.description }. The user has defined your role as: ${ idw.role }. Your name is ${ idw.name }. Your focus should be on providing relevant, accurate, and helpful information to support the user in their specific needs and tasks. The response must follow markdown syntax.',
|
|
49
62
|
},
|
|
63
|
+
search_order: 2,
|
|
50
64
|
};
|
|
51
65
|
var bing = {
|
|
52
66
|
name: 'Websearch',
|
|
@@ -62,6 +76,7 @@ var bing = {
|
|
|
62
76
|
topResultAsContent: false,
|
|
63
77
|
},
|
|
64
78
|
display_order: 50,
|
|
79
|
+
search_order: 2,
|
|
65
80
|
};
|
|
66
81
|
exports.datasources = [
|
|
67
82
|
knowledge,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasources.js","sourceRoot":"","sources":["../../../src/assets/models/datasources.ts"],"names":[],"mappings":";;;AAEA,IAAM,SAAS,GAAyB;IACtC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE;QACN,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,GAAG;QAChB,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,IAAI;QACf,eAAe,EAAE,CAAC;QAClB,gBAAgB,EAAE,CAAC;QACnB,eAAe,EAAE,CAAC;QAClB,KAAK,EAAE,EAAE;QACT,YAAY,EACV,+jBAA+jB;QACjkB,cAAc,EACZ,+WAA+W;KAClX;
|
|
1
|
+
{"version":3,"file":"datasources.js","sourceRoot":"","sources":["../../../src/assets/models/datasources.ts"],"names":[],"mappings":";;;AAEA,IAAM,SAAS,GAAyB;IACtC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,MAAM,EAAE;QACN,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,GAAG;QAChB,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,IAAI;QACf,eAAe,EAAE,CAAC;QAClB,gBAAgB,EAAE,CAAC;QACnB,eAAe,EAAE,CAAC;QAClB,KAAK,EAAE,EAAE;QACT,YAAY,EACV,+jBAA+jB;QACjkB,cAAc,EACZ,+WAA+W;KAClX;IACD,YAAY,EAAE,CAAC;CAChB,CAAC;AAEF,IAAM,MAAM,GAAyB;IACnC,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACN,IAAI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M;IACN,GAAG;IACH,IAAI;CACL,CAAC"}
|
|
@@ -6,28 +6,24 @@ var chatGpt = {
|
|
|
6
6
|
description: 'An AI model that provides conversational responses on various topics',
|
|
7
7
|
icon: 'chat',
|
|
8
8
|
datasources: ['gpt'],
|
|
9
|
-
search_order: 2,
|
|
10
9
|
};
|
|
11
10
|
var websearch = {
|
|
12
11
|
name: 'Websearch',
|
|
13
12
|
description: 'Searches the internet for up-to-date information, giving answers from current online sources for accurate responses',
|
|
14
13
|
icon: 'screen_search_desktop',
|
|
15
14
|
datasources: ['bing'],
|
|
16
|
-
search_order: 2,
|
|
17
15
|
};
|
|
18
16
|
var skills = {
|
|
19
17
|
name: 'Skills',
|
|
20
18
|
description: 'Specialized tools that perform specific tasks within the IDW',
|
|
21
19
|
icon: 'auto_awesome_motion',
|
|
22
20
|
datasources: ['skills'],
|
|
23
|
-
search_order: 1,
|
|
24
21
|
};
|
|
25
22
|
var knowledge = {
|
|
26
23
|
name: 'Internal Knowledge',
|
|
27
24
|
description: 'A data source of company-specific information that provides trusted, in-house answers aligned with organizational needs',
|
|
28
25
|
icon: 'local_library',
|
|
29
26
|
datasources: ['knowledge'],
|
|
30
|
-
search_order: 1,
|
|
31
27
|
};
|
|
32
28
|
exports.models = [
|
|
33
29
|
chatGpt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/assets/models/models.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/assets/models/models.ts"],"names":[],"mappings":";;;AAEA,IAAM,OAAO,GAAuB;IAClC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,sEAAsE;IACnF,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,CAAC,KAAK,CAAC;CACrB,CAAC;AAEF,IAAM,SAAS,GAAuB;IACpC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,qHAAqH;IAClI,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,CAAC,MAAM,CAAC;CACtB,CAAC;AAEF,IAAM,MAAM,GAAuB;IACjC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,8DAA8D;IAC3E,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,CAAC,QAAQ,CAAC;CACxB,CAAC;AAEF,IAAM,SAAS,GAAuB;IACpC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,yHAAyH;IACtI,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,CAAC,WAAW,CAAC;CAC3B,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,OAAO;IACP,SAAS;IACT,MAAM;IACN,SAAS;CACV,CAAC"}
|
|
@@ -53,6 +53,15 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
53
53
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
54
54
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
55
55
|
};
|
|
56
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
57
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
58
|
+
if (ar || !(i in from)) {
|
|
59
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
60
|
+
ar[i] = from[i];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
64
|
+
};
|
|
56
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
66
|
exports.InitLookupResources = void 0;
|
|
58
67
|
var lookup_1 = require("@or-sdk/lookup");
|
|
@@ -60,15 +69,60 @@ var collections_1 = require("../../assets/collections");
|
|
|
60
69
|
var skills_1 = require("../../assets/skills");
|
|
61
70
|
var lookup_utils_1 = require("./lookup_utils");
|
|
62
71
|
var default_knowledges_1 = require("../../assets/default_knowledges");
|
|
72
|
+
var idw_1 = require("@or-sdk/idw");
|
|
73
|
+
var AUTHOR_ID_PROPERTY = 'authorId';
|
|
63
74
|
var InitLookupResources = (function () {
|
|
64
75
|
function InitLookupResources(_a) {
|
|
65
76
|
var token = _a.token, discoveryUrl = _a.discoveryUrl;
|
|
77
|
+
var _this = this;
|
|
78
|
+
this.migrationAddAuthorIdToCustomKnowledge = function (documents) { return __awaiter(_this, void 0, void 0, function () {
|
|
79
|
+
var AUTHOR_ID_PROPERTY, customDocuments, authors, mapAuthorsId;
|
|
80
|
+
var _this = this;
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
AUTHOR_ID_PROPERTY = 'authorId';
|
|
85
|
+
customDocuments = documents.filter(function (doc) {
|
|
86
|
+
var _a;
|
|
87
|
+
return (!doc.properties || !doc.properties.some(function (prop) { return prop.name === 'defaultKnowledge' && prop.value === 'true'; })) &&
|
|
88
|
+
(!((_a = doc.properties) === null || _a === void 0 ? void 0 : _a.some(function (prop) { return prop.name === AUTHOR_ID_PROPERTY; })));
|
|
89
|
+
});
|
|
90
|
+
if (!customDocuments.length)
|
|
91
|
+
return [2];
|
|
92
|
+
return [4, Promise.all(customDocuments.map(function (doc) { return _this.idw.getOneKnowledge(doc.name); }))];
|
|
93
|
+
case 1:
|
|
94
|
+
authors = (_a.sent()).map(function (knowledge) { return knowledge.created_by; });
|
|
95
|
+
if (!authors.length)
|
|
96
|
+
return [2];
|
|
97
|
+
mapAuthorsId = this.addAuthorIdProperty.bind(this, authors);
|
|
98
|
+
return [4, Promise.all(customDocuments.map(mapAuthorsId))];
|
|
99
|
+
case 2:
|
|
100
|
+
_a.sent();
|
|
101
|
+
return [2];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}); };
|
|
105
|
+
this.addAuthorIdProperty = function (authors, doc, index) {
|
|
106
|
+
var authorProp = {
|
|
107
|
+
name: AUTHOR_ID_PROPERTY,
|
|
108
|
+
value: JSON.stringify(authors[index]),
|
|
109
|
+
};
|
|
110
|
+
var properties = doc.properties
|
|
111
|
+
? __spreadArray(__spreadArray([], doc.properties, true), [authorProp], false) : [authorProp];
|
|
112
|
+
return _this.lookup.updateDocument(doc.collection, doc.id, {
|
|
113
|
+
properties: properties,
|
|
114
|
+
});
|
|
115
|
+
};
|
|
66
116
|
this.token = token;
|
|
67
117
|
this.discoveryUrl = discoveryUrl;
|
|
68
118
|
this.lookup = new lookup_1.Lookup({
|
|
69
119
|
token: this.token,
|
|
70
120
|
discoveryUrl: this.discoveryUrl,
|
|
71
121
|
});
|
|
122
|
+
this.idw = new idw_1.IdwApiV2({
|
|
123
|
+
token: this.token,
|
|
124
|
+
discoveryUrl: this.discoveryUrl,
|
|
125
|
+
});
|
|
72
126
|
}
|
|
73
127
|
InitLookupResources.prototype.init = function () {
|
|
74
128
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -88,49 +142,52 @@ var InitLookupResources = (function () {
|
|
|
88
142
|
return [4, this.listDocuments(collections.knowledge)];
|
|
89
143
|
case 4:
|
|
90
144
|
existingDocuments = _e.sent();
|
|
91
|
-
|
|
145
|
+
return [4, this.migrationAddAuthorIdToCustomKnowledge(existingDocuments)];
|
|
92
146
|
case 5:
|
|
93
|
-
_e.
|
|
94
|
-
_a = true, DEFAULT_KNOWLEDGE_DOCUMENTS_1 = __asyncValues(default_knowledges_1.DEFAULT_KNOWLEDGE_DOCUMENTS);
|
|
147
|
+
_e.sent();
|
|
95
148
|
_e.label = 6;
|
|
96
|
-
case 6:
|
|
97
|
-
|
|
98
|
-
|
|
149
|
+
case 6:
|
|
150
|
+
_e.trys.push([6, 12, 13, 18]);
|
|
151
|
+
_a = true, DEFAULT_KNOWLEDGE_DOCUMENTS_1 = __asyncValues(default_knowledges_1.DEFAULT_KNOWLEDGE_DOCUMENTS);
|
|
152
|
+
_e.label = 7;
|
|
153
|
+
case 7: return [4, DEFAULT_KNOWLEDGE_DOCUMENTS_1.next()];
|
|
154
|
+
case 8:
|
|
155
|
+
if (!(DEFAULT_KNOWLEDGE_DOCUMENTS_1_1 = _e.sent(), _b = DEFAULT_KNOWLEDGE_DOCUMENTS_1_1.done, !_b)) return [3, 11];
|
|
99
156
|
_d = DEFAULT_KNOWLEDGE_DOCUMENTS_1_1.value;
|
|
100
157
|
_a = false;
|
|
101
158
|
document_1 = _d;
|
|
102
159
|
return [4, this.upsertDefaultKnowledgeDocument(collections.knowledge, document_1, existingDocuments)];
|
|
103
|
-
case 8:
|
|
104
|
-
_e.sent();
|
|
105
|
-
_e.label = 9;
|
|
106
160
|
case 9:
|
|
161
|
+
_e.sent();
|
|
162
|
+
_e.label = 10;
|
|
163
|
+
case 10:
|
|
107
164
|
_a = true;
|
|
108
|
-
return [3,
|
|
109
|
-
case
|
|
110
|
-
case
|
|
165
|
+
return [3, 7];
|
|
166
|
+
case 11: return [3, 18];
|
|
167
|
+
case 12:
|
|
111
168
|
e_1_1 = _e.sent();
|
|
112
169
|
e_1 = { error: e_1_1 };
|
|
113
|
-
return [3,
|
|
114
|
-
case 12:
|
|
115
|
-
_e.trys.push([12, , 15, 16]);
|
|
116
|
-
if (!(!_a && !_b && (_c = DEFAULT_KNOWLEDGE_DOCUMENTS_1.return))) return [3, 14];
|
|
117
|
-
return [4, _c.call(DEFAULT_KNOWLEDGE_DOCUMENTS_1)];
|
|
170
|
+
return [3, 18];
|
|
118
171
|
case 13:
|
|
172
|
+
_e.trys.push([13, , 16, 17]);
|
|
173
|
+
if (!(!_a && !_b && (_c = DEFAULT_KNOWLEDGE_DOCUMENTS_1.return))) return [3, 15];
|
|
174
|
+
return [4, _c.call(DEFAULT_KNOWLEDGE_DOCUMENTS_1)];
|
|
175
|
+
case 14:
|
|
119
176
|
_e.sent();
|
|
120
|
-
_e.label =
|
|
121
|
-
case
|
|
122
|
-
case
|
|
177
|
+
_e.label = 15;
|
|
178
|
+
case 15: return [3, 17];
|
|
179
|
+
case 16:
|
|
123
180
|
if (e_1) throw e_1.error;
|
|
124
181
|
return [7];
|
|
125
|
-
case
|
|
126
|
-
case
|
|
182
|
+
case 17: return [7];
|
|
183
|
+
case 18:
|
|
127
184
|
deprecatedKnowledge = existingDocuments.find(function (kn) { return kn.name === 'default_knowledge'; });
|
|
128
|
-
if (!deprecatedKnowledge) return [3,
|
|
185
|
+
if (!deprecatedKnowledge) return [3, 20];
|
|
129
186
|
return [4, this.lookup.deleteDocument(collections.knowledge, deprecatedKnowledge.id)];
|
|
130
|
-
case
|
|
187
|
+
case 19:
|
|
131
188
|
_e.sent();
|
|
132
|
-
_e.label =
|
|
133
|
-
case
|
|
189
|
+
_e.label = 20;
|
|
190
|
+
case 20: return [2, collections];
|
|
134
191
|
}
|
|
135
192
|
});
|
|
136
193
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../src/initializers/lookup/lookup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../src/initializers/lookup/lookup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwD;AAExD,wDAAyF;AACzF,8CAA6C;AAQ7C,+CAOwB;AACxB,sEAA8E;AAC9E,mCAAuC;AAGvC,IAAM,kBAAkB,GAAG,UAAU,CAAC;AAEtC;IAME,6BAAY,EAAkD;YAAhD,KAAK,WAAA,EAAE,YAAY,kBAAA;QAAjC,iBAaC;QA6ND,0CAAqC,GAAG,UAAO,SAAqB;;;;;;wBAC5D,kBAAkB,GAAG,UAAU,CAAC;wBAEhC,eAAe,GAAG,SAAS,CAAC,MAAM,CAAC,UAAA,GAAG;;4BAC1C,OAAA,CAAC,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,IA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AAC;wBACT,KAAK,GAAe,EAAE,CAAC;;4BAER,WAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE;4BAC7D,IAAI,MAAA;4BACJ,IAAI,EAAE,QAAQ;yBACf,CAAC,EAAA;;wBAHI,QAAQ,GAAG,SAGf;wBAEF,KAAK,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,mCAAI,EAAE,CAAC;wBAC9B,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;4BACjB,MAAM,CAAC,IAAI,OAAX,MAAM,EAAS,KAAK,EAAE;4BACtB,IAAI,IAAI,QAAQ,CAAC;wBACnB,CAAC;;;4BACM,KAAK,CAAC,MAAM,KAAK,QAAQ;;4BAElC,WAAO,MAAM,EAAC;;;;KACf;IAgCH,0BAAC;AAAD,CAAC,AA9QD,IA8QC;AA9QY,kDAAmB"}
|
package/dist/initializers/rdb.js
CHANGED
|
@@ -161,13 +161,14 @@ var InitRdbResources = (function () {
|
|
|
161
161
|
case 1:
|
|
162
162
|
if (!(_i < datasources_1.length)) return [3, 4];
|
|
163
163
|
ds = datasources_1[_i];
|
|
164
|
-
return [4, sequelize.query("\n INSERT INTO datasources (name, slug, description, config, display_order, icon_url, is_default)\n VALUES (:name, :slug, :description, :config, :display_order, :icon_url, :is_default)\n ON CONFLICT (slug) DO UPDATE\n SET description = EXCLUDED.description,\n config = EXCLUDED.config,\n display_order = EXCLUDED.display_order,\n icon_url = EXCLUDED.icon_url,\n updated_at = NOW();\n ", {
|
|
164
|
+
return [4, sequelize.query("\n INSERT INTO datasources (name, slug, description, config, display_order, icon_url, is_default)\n VALUES (:name, :slug, :description, :config, :display_order, :icon_url, :is_default)\n ON CONFLICT (slug) DO UPDATE\n SET description = EXCLUDED.description,\n config = EXCLUDED.config,\n display_order = EXCLUDED.display_order,\n search_order = EXCLUDED.search_order,\n icon_url = EXCLUDED.icon_url,\n updated_at = NOW();\n ", {
|
|
165
165
|
replacements: {
|
|
166
166
|
name: ds.name,
|
|
167
167
|
slug: ds.slug,
|
|
168
168
|
description: ds.description || null,
|
|
169
169
|
config: ds.config ? JSON.stringify(ds.config) : null,
|
|
170
170
|
display_order: ds.display_order || 10,
|
|
171
|
+
search_order: ds.search_order || 1,
|
|
171
172
|
icon_url: ds.icon_url || null,
|
|
172
173
|
is_default: true,
|
|
173
174
|
},
|
|
@@ -185,14 +186,13 @@ var InitRdbResources = (function () {
|
|
|
185
186
|
case 5:
|
|
186
187
|
if (!(_a < models_2.length)) return [3, 12];
|
|
187
188
|
model = models_2[_a];
|
|
188
|
-
return [4, sequelize.query("\n INSERT INTO models (name, description, is_default, for_user_roles, icon, search_order)\n VALUES (:name, :description, :is_default, :for_user_roles, :icon, :search_order)\n ON CONFLICT (name) DO UPDATE\n SET description = EXCLUDED.description,\n is_default = EXCLUDED.is_default,\n for_user_roles = EXCLUDED.for_user_roles,\n icon = EXCLUDED.icon,\n
|
|
189
|
+
return [4, sequelize.query("\n INSERT INTO models (name, description, is_default, for_user_roles, icon, search_order)\n VALUES (:name, :description, :is_default, :for_user_roles, :icon, :search_order)\n ON CONFLICT (name) DO UPDATE\n SET description = EXCLUDED.description,\n is_default = EXCLUDED.is_default,\n for_user_roles = EXCLUDED.for_user_roles,\n icon = EXCLUDED.icon,\n updated_at = NOW()\n RETURNING id;\n ", {
|
|
189
190
|
replacements: {
|
|
190
191
|
name: model.name,
|
|
191
192
|
description: model.description || null,
|
|
192
193
|
is_default: true,
|
|
193
194
|
for_user_roles: model.for_user_roles ? JSON.stringify(model.for_user_roles) : null,
|
|
194
195
|
icon: model.icon || null,
|
|
195
|
-
search_order: model.search_order || 1,
|
|
196
196
|
},
|
|
197
197
|
transaction: transaction,
|
|
198
198
|
})];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdb.js","sourceRoot":"","sources":["../../src/initializers/rdb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EAAE,KAAK;yBACf,CAAC,CAAC;;;;wBAGe,WAAM,gBAAgB,CAAC,KAAK,CAAC,kFAIhD,EAAE;gCACC,YAAY,EAAE;oCACZ,OAAO,EAAE,0BAAgB,CAAC,IAAI;iCAC/B;6BACF,CAAC,EAAA;;wBARK,OAAO,GAAI,CAAA,SAQhB,CAAA,GARY;wBAUR,kBAAkB,GAAG,MAAC,OAAO,CAAC,CAAC,CAAqB,0CAAE,EAAE,CAAC;wBAE/D,WAAM,SAAS,CAAC,KAAK,CAAC,gGAIrB,EAAE;gCACD,YAAY,EAAE;oCACZ,KAAK,EAAE,kBAAkB;iCAC1B;6BACF,CAAC,EAAA;;wBARF,SAQE,CAAC;;;;wBAEH,OAAO,CAAC,KAAK,CAAC,mDAAmD,EAAE,GAAC,CAAC,CAAC;;4BAEtE,WAAM,gBAAgB,CAAC,KAAK,EAAE,EAAA;;wBAA9B,SAA8B,CAAC;;;;;;KAElC;IACH,uBAAC;AAAD,CAAC,AAzND,IAyNC;AAzNY,4CAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/idw-init-account-resources",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Creation of required resources in OneReach account to enable IDW",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"contributors": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@or-sdk/files": "3.4.36",
|
|
15
15
|
"@or-sdk/graph": "1.7.26",
|
|
16
16
|
"@or-sdk/hitl": "0.34.35",
|
|
17
|
-
"@or-sdk/idw": "7.
|
|
17
|
+
"@or-sdk/idw": "7.9.0",
|
|
18
18
|
"@or-sdk/lookup": "1.14.5",
|
|
19
19
|
"@or-sdk/pgsql": "1.1.8",
|
|
20
20
|
"pg": "8.11.5",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import { QueryInterface, Sequelize } from 'sequelize';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
/** @type {import('sequelize-cli').Migration} */
|
|
6
|
+
module.exports = {
|
|
7
|
+
async up(queryInterface: QueryInterface & {context: {sequelize: Sequelize;};}) {
|
|
8
|
+
await queryInterface.sequelize.query(`
|
|
9
|
+
ALTER TABLE models
|
|
10
|
+
DROP COLUMN IF EXISTS search_order,
|
|
11
|
+
DROP COLUMN IF EXISTS parent_model_id;
|
|
12
|
+
|
|
13
|
+
ALTER TABLE datasources
|
|
14
|
+
ADD COLUMN IF NOT EXISTS search_order SMALLINT DEFAULT 1;
|
|
15
|
+
`);
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
async down(queryInterface: QueryInterface & { context: { sequelize: Sequelize; }; }) {
|
|
19
|
+
await queryInterface.sequelize.query(
|
|
20
|
+
'ALTER TABLE datasources DROP COLUMN IF EXISTS search_order;'
|
|
21
|
+
);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -18,6 +18,7 @@ const knowledge: DatasourceDefinition = {
|
|
|
18
18
|
questionPrompt:
|
|
19
19
|
'Generate a Standalone question using the original language that accurately rephrases the Follow Up Input. However,\nif the Follow Up Input is unrelated to the chat history or if there is no chat history available, the Follow Up\nInput should be returned unchanged, without rephrasing.\n\nChat History:{chat_history}\nFollow Up Input:{question}\nStandalone question:',
|
|
20
20
|
},
|
|
21
|
+
search_order: 1,
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
const skills: DatasourceDefinition = {
|
|
@@ -26,11 +27,23 @@ const skills: DatasourceDefinition = {
|
|
|
26
27
|
config: {
|
|
27
28
|
icon: null,
|
|
28
29
|
config: {
|
|
29
|
-
distance: 0.
|
|
30
|
+
distance: 0.25,
|
|
30
31
|
limit: 5,
|
|
32
|
+
chunkSize: 10,
|
|
33
|
+
provider: 'openai',
|
|
34
|
+
model: 'gpt-4o-mini',
|
|
35
|
+
temperature: 0,
|
|
36
|
+
maxTokens: 2048,
|
|
37
|
+
historyCapacity: 10,
|
|
38
|
+
frequencyPenalty: 0,
|
|
39
|
+
presencePenalty: 0,
|
|
40
|
+
stop: null,
|
|
41
|
+
topP: 1,
|
|
42
|
+
n: 1,
|
|
31
43
|
},
|
|
32
44
|
},
|
|
33
45
|
display_order: 50,
|
|
46
|
+
search_order: 1,
|
|
34
47
|
};
|
|
35
48
|
|
|
36
49
|
const gpt: DatasourceDefinition = {
|
|
@@ -38,9 +51,9 @@ const gpt: DatasourceDefinition = {
|
|
|
38
51
|
slug: 'gpt',
|
|
39
52
|
icon_url: 'https://static.vecteezy.com/system/resources/previews/022/227/367/large_2x/openai-chatgpt-logo-icon-free-png.png',
|
|
40
53
|
config: {
|
|
54
|
+
provider: 'openai',
|
|
41
55
|
model: 'gpt-4o-mini',
|
|
42
56
|
temperature: 0.4,
|
|
43
|
-
distance: 0.23,
|
|
44
57
|
maxTokens: 2048,
|
|
45
58
|
historyCapacity: 10,
|
|
46
59
|
frequencyPenalty: 0,
|
|
@@ -50,6 +63,7 @@ const gpt: DatasourceDefinition = {
|
|
|
50
63
|
n: 1,
|
|
51
64
|
systemPrompt: 'You are an AI assistant designed by the company OneReach.ai, to help the user achieve their goals. Your main function is to assist with tasks related to: ${ idw.description }. The user has defined your role as: ${ idw.role }. Your name is ${ idw.name }. Your focus should be on providing relevant, accurate, and helpful information to support the user in their specific needs and tasks. The response must follow markdown syntax.',
|
|
52
65
|
},
|
|
66
|
+
search_order: 2,
|
|
53
67
|
};
|
|
54
68
|
|
|
55
69
|
const bing: DatasourceDefinition = {
|
|
@@ -66,6 +80,7 @@ const bing: DatasourceDefinition = {
|
|
|
66
80
|
topResultAsContent: false,
|
|
67
81
|
},
|
|
68
82
|
display_order: 50,
|
|
83
|
+
search_order: 2,
|
|
69
84
|
};
|
|
70
85
|
|
|
71
86
|
export const datasources = [
|
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
import { IdwModelDefinition } from '../../types';
|
|
2
2
|
|
|
3
|
-
// const internal: IdwModelDefinition = {
|
|
4
|
-
// name: 'Internal',
|
|
5
|
-
// icon: 'home',
|
|
6
|
-
// for_user_roles: ['user', 'admin'],
|
|
7
|
-
// datasources: ['knowledge', 'skills'],
|
|
8
|
-
// search_order: 1,
|
|
9
|
-
// visibility: 'none',
|
|
10
|
-
// };
|
|
11
|
-
|
|
12
|
-
// const external: IdwModelDefinition = {
|
|
13
|
-
// name: 'External',
|
|
14
|
-
// icon: 'public',
|
|
15
|
-
// datasources: ['gpt', 'bing'],
|
|
16
|
-
// search_order: 2,
|
|
17
|
-
// visibility: 'none',
|
|
18
|
-
// };
|
|
19
|
-
|
|
20
3
|
const chatGpt: IdwModelDefinition = {
|
|
21
4
|
name: 'ChatGPT',
|
|
22
5
|
description: 'An AI model that provides conversational responses on various topics',
|
|
23
6
|
icon: 'chat',
|
|
24
7
|
datasources: ['gpt'],
|
|
25
|
-
search_order: 2,
|
|
26
8
|
};
|
|
27
9
|
|
|
28
10
|
const websearch: IdwModelDefinition = {
|
|
@@ -30,7 +12,6 @@ const websearch: IdwModelDefinition = {
|
|
|
30
12
|
description: 'Searches the internet for up-to-date information, giving answers from current online sources for accurate responses',
|
|
31
13
|
icon: 'screen_search_desktop',
|
|
32
14
|
datasources: ['bing'],
|
|
33
|
-
search_order: 2,
|
|
34
15
|
};
|
|
35
16
|
|
|
36
17
|
const skills: IdwModelDefinition = {
|
|
@@ -38,7 +19,6 @@ const skills: IdwModelDefinition = {
|
|
|
38
19
|
description: 'Specialized tools that perform specific tasks within the IDW',
|
|
39
20
|
icon: 'auto_awesome_motion',
|
|
40
21
|
datasources: ['skills'],
|
|
41
|
-
search_order: 1,
|
|
42
22
|
};
|
|
43
23
|
|
|
44
24
|
const knowledge: IdwModelDefinition = {
|
|
@@ -46,12 +26,9 @@ const knowledge: IdwModelDefinition = {
|
|
|
46
26
|
description: 'A data source of company-specific information that provides trusted, in-house answers aligned with organizational needs',
|
|
47
27
|
icon: 'local_library',
|
|
48
28
|
datasources: ['knowledge'],
|
|
49
|
-
search_order: 1,
|
|
50
29
|
};
|
|
51
30
|
|
|
52
31
|
export const models = [
|
|
53
|
-
// internal,
|
|
54
|
-
// external,
|
|
55
32
|
chatGpt,
|
|
56
33
|
websearch,
|
|
57
34
|
skills,
|
|
@@ -3,7 +3,6 @@ import { SkillDefinition, InitLookupResourcesConfig, UpsertCollectionsResult, Kn
|
|
|
3
3
|
import { skillsCollectionData, knowledgeCollectionData } from '../../assets/collections';
|
|
4
4
|
import { skills } from '../../assets/skills';
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
import type {
|
|
8
7
|
Collection,
|
|
9
8
|
CreateCollection,
|
|
@@ -19,11 +18,16 @@ import {
|
|
|
19
18
|
isDefaultKnowledgeUpdated,
|
|
20
19
|
} from './lookup_utils';
|
|
21
20
|
import { DEFAULT_KNOWLEDGE_DOCUMENTS } from '../../assets/default_knowledges';
|
|
21
|
+
import { IdwApiV2 } from '@or-sdk/idw';
|
|
22
|
+
import { DocumentProperty } from '@or-sdk/lookup/src/types';
|
|
23
|
+
|
|
24
|
+
const AUTHOR_ID_PROPERTY = 'authorId';
|
|
22
25
|
|
|
23
26
|
export class InitLookupResources {
|
|
24
27
|
private token: string;
|
|
25
28
|
private discoveryUrl: string;
|
|
26
29
|
private lookup: Lookup;
|
|
30
|
+
private idw: IdwApiV2;
|
|
27
31
|
|
|
28
32
|
constructor({ token, discoveryUrl }: InitLookupResourcesConfig) {
|
|
29
33
|
this.token = token;
|
|
@@ -33,6 +37,11 @@ export class InitLookupResources {
|
|
|
33
37
|
token: this.token,
|
|
34
38
|
discoveryUrl: this.discoveryUrl,
|
|
35
39
|
});
|
|
40
|
+
|
|
41
|
+
this.idw = new IdwApiV2({
|
|
42
|
+
token: this.token,
|
|
43
|
+
discoveryUrl: this.discoveryUrl,
|
|
44
|
+
});
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
public async init(): Promise<UpsertCollectionsResult> {
|
|
@@ -43,6 +52,9 @@ export class InitLookupResources {
|
|
|
43
52
|
|
|
44
53
|
const existingDocuments = await this.listDocuments(collections.knowledge);
|
|
45
54
|
|
|
55
|
+
// add authorId property to old (04/25) custom knowledge
|
|
56
|
+
await this.migrationAddAuthorIdToCustomKnowledge(existingDocuments);
|
|
57
|
+
|
|
46
58
|
for await (const document of DEFAULT_KNOWLEDGE_DOCUMENTS) {
|
|
47
59
|
await this.upsertDefaultKnowledgeDocument(collections.knowledge, document, existingDocuments);
|
|
48
60
|
}
|
|
@@ -250,4 +262,35 @@ export class InitLookupResources {
|
|
|
250
262
|
|
|
251
263
|
return result;
|
|
252
264
|
}
|
|
265
|
+
|
|
266
|
+
migrationAddAuthorIdToCustomKnowledge = async (documents: Document[]) => {
|
|
267
|
+
const AUTHOR_ID_PROPERTY = 'authorId';
|
|
268
|
+
|
|
269
|
+
const customDocuments = documents.filter(doc =>
|
|
270
|
+
(!doc.properties || !doc.properties.some(prop => prop.name === 'defaultKnowledge' && prop.value === 'true')) &&
|
|
271
|
+
(!doc.properties?.some(prop => prop.name === AUTHOR_ID_PROPERTY)));
|
|
272
|
+
|
|
273
|
+
if (!customDocuments.length) return;
|
|
274
|
+
|
|
275
|
+
const authors = (await Promise.all(customDocuments.map(doc => this.idw.getOneKnowledge(doc.name)))).map(knowledge => knowledge.created_by);
|
|
276
|
+
|
|
277
|
+
if (!authors.length) return;
|
|
278
|
+
|
|
279
|
+
const mapAuthorsId = this.addAuthorIdProperty.bind(this, authors);
|
|
280
|
+
await Promise.all(customDocuments.map(mapAuthorsId));
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
addAuthorIdProperty = (authors: string[], doc: Document, index: number) => {
|
|
284
|
+
const authorProp = {
|
|
285
|
+
name: AUTHOR_ID_PROPERTY,
|
|
286
|
+
value: JSON.stringify(authors[index]),
|
|
287
|
+
};
|
|
288
|
+
const properties: DocumentProperty[] = doc.properties
|
|
289
|
+
? [...doc.properties, authorProp]
|
|
290
|
+
: [authorProp];
|
|
291
|
+
|
|
292
|
+
return this.lookup.updateDocument(doc.collection, doc.id, {
|
|
293
|
+
properties,
|
|
294
|
+
});
|
|
295
|
+
};
|
|
253
296
|
}
|
package/src/initializers/rdb.ts
CHANGED
|
@@ -105,6 +105,7 @@ export class InitRdbResources {
|
|
|
105
105
|
SET description = EXCLUDED.description,
|
|
106
106
|
config = EXCLUDED.config,
|
|
107
107
|
display_order = EXCLUDED.display_order,
|
|
108
|
+
search_order = EXCLUDED.search_order,
|
|
108
109
|
icon_url = EXCLUDED.icon_url,
|
|
109
110
|
updated_at = NOW();
|
|
110
111
|
`,
|
|
@@ -115,6 +116,7 @@ export class InitRdbResources {
|
|
|
115
116
|
description: ds.description || null,
|
|
116
117
|
config: ds.config ? JSON.stringify(ds.config) : null,
|
|
117
118
|
display_order: ds.display_order || 10,
|
|
119
|
+
search_order: ds.search_order || 1,
|
|
118
120
|
icon_url: ds.icon_url || null,
|
|
119
121
|
is_default: true,
|
|
120
122
|
},
|
|
@@ -134,7 +136,6 @@ export class InitRdbResources {
|
|
|
134
136
|
is_default = EXCLUDED.is_default,
|
|
135
137
|
for_user_roles = EXCLUDED.for_user_roles,
|
|
136
138
|
icon = EXCLUDED.icon,
|
|
137
|
-
search_order = EXCLUDED.search_order,
|
|
138
139
|
updated_at = NOW()
|
|
139
140
|
RETURNING id;
|
|
140
141
|
`,
|
|
@@ -145,7 +146,6 @@ export class InitRdbResources {
|
|
|
145
146
|
is_default: true,
|
|
146
147
|
for_user_roles: model.for_user_roles ? JSON.stringify(model.for_user_roles) : null,
|
|
147
148
|
icon: model.icon || null,
|
|
148
|
-
search_order: model.search_order || 1,
|
|
149
149
|
},
|
|
150
150
|
transaction,
|
|
151
151
|
}
|
package/src/types.ts
CHANGED
|
@@ -90,6 +90,7 @@ export type DatasourceDefinition = {
|
|
|
90
90
|
description?: string;
|
|
91
91
|
config?: Record<string, unknown>;
|
|
92
92
|
is_default?: boolean;
|
|
93
|
+
search_order?: number;
|
|
93
94
|
display_order?: number;
|
|
94
95
|
icon_url?: string;
|
|
95
96
|
created_by?: string;
|
|
@@ -100,10 +101,8 @@ export type IdwModelDefinition = {
|
|
|
100
101
|
name: string;
|
|
101
102
|
description?: string;
|
|
102
103
|
for_user_roles?: string[];
|
|
103
|
-
parent_model_id?: string;
|
|
104
104
|
is_default?: boolean;
|
|
105
105
|
icon?: string;
|
|
106
|
-
search_order?: number;
|
|
107
106
|
visibility?: 'none' | 'user' | 'account' | null;
|
|
108
107
|
created_by?: string;
|
|
109
108
|
updated_by?: string;
|