backend-manager 3.2.175 → 3.2.176
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/package.json +1 -1
- package/src/manager/functions/core/actions/api/admin/database-read.js +5 -0
- package/src/manager/functions/core/actions/api/admin/database-write.js +6 -0
- package/src/manager/functions/core/actions/api/admin/firestore-query.js +6 -1
- package/src/manager/functions/core/actions/api/admin/firestore-read.js +5 -0
- package/src/manager/functions/core/actions/api/admin/firestore-write.js +7 -0
- package/src/manager/libraries/openai.js +43 -21
package/package.json
CHANGED
|
@@ -21,6 +21,11 @@ Module.prototype.main = function () {
|
|
|
21
21
|
return reject(assistant.errorify(`<path> parameter required`, {code: 400}));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
// Log
|
|
25
|
+
assistant.log(`main(): Read`,
|
|
26
|
+
payload.data.payload.path,
|
|
27
|
+
);
|
|
28
|
+
|
|
24
29
|
// Read from Firestore
|
|
25
30
|
self.libraries.admin.database().ref(payload.data.payload.path)
|
|
26
31
|
.on('value', (snapshot) => {
|
|
@@ -22,6 +22,12 @@ Module.prototype.main = function () {
|
|
|
22
22
|
return reject(assistant.errorify(`<path> parameter required`, {code: 400}));
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
// Log
|
|
26
|
+
assistant.log(`main(): Write`,
|
|
27
|
+
payload.data.payload.path,
|
|
28
|
+
payload.data.payload.document,
|
|
29
|
+
);
|
|
30
|
+
|
|
25
31
|
// Write to Firestore
|
|
26
32
|
self.libraries.admin.database().ref(payload.data.payload.path)
|
|
27
33
|
.set(payload.data.payload.document)
|
|
@@ -20,9 +20,14 @@ Module.prototype.main = function () {
|
|
|
20
20
|
|
|
21
21
|
// Run queries
|
|
22
22
|
self.docs = [];
|
|
23
|
-
assistant.log('Queries', payload.data.payload.queries);
|
|
24
23
|
let queries = powertools.arrayify(payload.data.payload.queries || []);
|
|
25
24
|
|
|
25
|
+
// Log
|
|
26
|
+
assistant.log(`main(): Queries`,
|
|
27
|
+
payload.data.payload.queries,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// Run the queries
|
|
26
31
|
let promises = [];
|
|
27
32
|
for (var i = 0; i < queries.length; i++) {
|
|
28
33
|
queries[i]
|
|
@@ -21,6 +21,11 @@ Module.prototype.main = function () {
|
|
|
21
21
|
return reject(assistant.errorify(`<path> parameter required`, {code: 400}));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
// Log
|
|
25
|
+
assistant.log(`main(): Reading`,
|
|
26
|
+
payload.data.payload.path,
|
|
27
|
+
);
|
|
28
|
+
|
|
24
29
|
// Read from Firestore
|
|
25
30
|
await self.libraries.admin.firestore().doc(payload.data.payload.path)
|
|
26
31
|
.get()
|
|
@@ -37,6 +37,13 @@ Module.prototype.main = function () {
|
|
|
37
37
|
// Delete metadataTag
|
|
38
38
|
delete payload.data.payload.options.metadataTag;
|
|
39
39
|
|
|
40
|
+
// Log
|
|
41
|
+
assistant.log(`main(): Writing`,
|
|
42
|
+
payload.data.payload.path,
|
|
43
|
+
payload.data.payload.document,
|
|
44
|
+
payload.data.payload.options
|
|
45
|
+
);
|
|
46
|
+
|
|
40
47
|
// Write to Firestore
|
|
41
48
|
await self.libraries.admin.firestore().doc(payload.data.payload.path)
|
|
42
49
|
.set(payload.data.payload.document, payload.data.payload.options)
|
|
@@ -7,36 +7,58 @@ const JSON5 = require('json5');
|
|
|
7
7
|
// Constants
|
|
8
8
|
const DEFAULT_MODEL = 'gpt-4o';
|
|
9
9
|
const TOKEN_COST_TABLE = {
|
|
10
|
-
//
|
|
10
|
+
// Jul 18th, 2024
|
|
11
|
+
'gpt-4o-mini': {
|
|
12
|
+
input: 0.000150,
|
|
13
|
+
output: 0.000600,
|
|
14
|
+
},
|
|
11
15
|
'gpt-4o': {
|
|
12
|
-
input: 0.
|
|
13
|
-
output: 0.
|
|
16
|
+
input: 0.00500,
|
|
17
|
+
output: 0.01500,
|
|
14
18
|
},
|
|
15
19
|
'gpt-4-turbo': {
|
|
16
|
-
input: 0.
|
|
17
|
-
output: 0.
|
|
18
|
-
},
|
|
19
|
-
'gpt-4-turbo-preview': {
|
|
20
|
-
input: 0.0100,
|
|
21
|
-
output: 0.0300,
|
|
22
|
-
},
|
|
23
|
-
'gpt-4-vision-preview': {
|
|
24
|
-
input: 0.0100,
|
|
25
|
-
output: 0.0300,
|
|
26
|
-
},
|
|
27
|
-
'gpt-4-1106-preview': {
|
|
28
|
-
input: 0.0100,
|
|
29
|
-
output: 0.0300,
|
|
20
|
+
input: 0.01000,
|
|
21
|
+
output: 0.03000,
|
|
30
22
|
},
|
|
31
23
|
'gpt-4': {
|
|
32
|
-
input: 0.
|
|
33
|
-
output: 0.
|
|
24
|
+
input: 0.03000,
|
|
25
|
+
output: 0.06000,
|
|
34
26
|
},
|
|
35
27
|
'gpt-3.5-turbo': {
|
|
36
|
-
input: 0.
|
|
37
|
-
output: 0.
|
|
28
|
+
input: 0.00050,
|
|
29
|
+
output: 0.00150,
|
|
38
30
|
},
|
|
39
31
|
|
|
32
|
+
// // May 13th, 2024
|
|
33
|
+
// 'gpt-4o': {
|
|
34
|
+
// input: 0.0050,
|
|
35
|
+
// output: 0.0150,
|
|
36
|
+
// },
|
|
37
|
+
// 'gpt-4-turbo': {
|
|
38
|
+
// input: 0.0100,
|
|
39
|
+
// output: 0.0300,
|
|
40
|
+
// },
|
|
41
|
+
// 'gpt-4-turbo-preview': {
|
|
42
|
+
// input: 0.0100,
|
|
43
|
+
// output: 0.0300,
|
|
44
|
+
// },
|
|
45
|
+
// 'gpt-4-vision-preview': {
|
|
46
|
+
// input: 0.0100,
|
|
47
|
+
// output: 0.0300,
|
|
48
|
+
// },
|
|
49
|
+
// 'gpt-4-1106-preview': {
|
|
50
|
+
// input: 0.0100,
|
|
51
|
+
// output: 0.0300,
|
|
52
|
+
// },
|
|
53
|
+
// 'gpt-4': {
|
|
54
|
+
// input: 0.0300,
|
|
55
|
+
// output: 0.0600,
|
|
56
|
+
// },
|
|
57
|
+
// 'gpt-3.5-turbo': {
|
|
58
|
+
// input: 0.0005,
|
|
59
|
+
// output: 0.0015,
|
|
60
|
+
// },
|
|
61
|
+
|
|
40
62
|
// // Apr 9th, 2024
|
|
41
63
|
// 'gpt-4-turbo': {
|
|
42
64
|
// input: 0.0100,
|