backend-manager 3.2.72 → 3.2.74
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
CHANGED
|
@@ -41,8 +41,8 @@ Module.prototype.main = function () {
|
|
|
41
41
|
assistant.log(`onDownload(): tempPath`, tempPath);
|
|
42
42
|
assistant.log(`onDownload(): finalPath`, finalPath);
|
|
43
43
|
|
|
44
|
-
// Check for missing paths
|
|
45
|
-
if (!tempPath || !finalPath) {
|
|
44
|
+
// Check for missing paths (need to check for meta.finalPath as well because it's not always set)
|
|
45
|
+
if (!tempPath || !finalPath || !meta.finalPath) {
|
|
46
46
|
return reject(new Error(`onDownload(): tempPath or finalPath is missing`));
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -2,6 +2,7 @@ const fetch = require('wonderful-fetch');
|
|
|
2
2
|
const jetpack = require('fs-jetpack');
|
|
3
3
|
const powertools = require('node-powertools');
|
|
4
4
|
const _ = require('lodash');
|
|
5
|
+
const JSON5 = require('json5');
|
|
5
6
|
|
|
6
7
|
const TOKEN_COST_TABLE = {
|
|
7
8
|
// Nov 6th, 2023
|
|
@@ -234,7 +235,7 @@ OpenAI.prototype.request = function (options) {
|
|
|
234
235
|
await _request('chatgpt', options)
|
|
235
236
|
.then((r) => {
|
|
236
237
|
try {
|
|
237
|
-
const content = options.response === 'json' ?
|
|
238
|
+
const content = options.response === 'json' ? JSON5.parse(r) : r;
|
|
238
239
|
|
|
239
240
|
return resolve({
|
|
240
241
|
content: content,
|