@cobrowser/chatgpt 0.7.23-beta.2 → 0.7.24
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.
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const axios_1 = __importDefault(require("axios"));
|
|
7
|
-
const logger_1 = __importDefault(require("../logger"));
|
|
8
7
|
const xss_validation_1 = require("@cobrowser/xss-validation");
|
|
8
|
+
const logger_1 = __importDefault(require("../logger"));
|
|
9
9
|
class BaseService {
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
@@ -111,11 +111,7 @@ class BaseService {
|
|
|
111
111
|
}
|
|
112
112
|
const parsed = JSON.parse(data), translation = parsed.data[0].translation, sanitized = xss_validation_1.XSSProtector.sanitize(translation), encoded = xss_validation_1.XSSProtector.encode(sanitized);
|
|
113
113
|
parsed.data[0].translation = encoded;
|
|
114
|
-
|
|
115
|
-
console.log('parsed: ', parsed);
|
|
116
|
-
console.log('sanitized: ', sanitized);
|
|
117
|
-
console.log('encoded: ', encoded);
|
|
118
|
-
logger_1.default.info({ data, parsed, sanitized, encoded }, ':: Sanitizing Response ::');
|
|
114
|
+
logger_1.default.info({ data, parsed, sanitized, encoded }, ':: Sanitized Response ::');
|
|
119
115
|
return JSON.stringify(parsed);
|
|
120
116
|
}
|
|
121
117
|
}
|
|
@@ -52,7 +52,7 @@ class TranslationService extends BaseService_1.default {
|
|
|
52
52
|
],
|
|
53
53
|
};
|
|
54
54
|
try {
|
|
55
|
-
logger_1.default.info(
|
|
55
|
+
logger_1.default.info({ requestBody }, ':: TranslationServicee.translate :: Translating ::');
|
|
56
56
|
const response = yield this.request.post('', requestBody);
|
|
57
57
|
return {
|
|
58
58
|
firstChoice: this.output(this.getResponseFirstChoice(response)),
|
|
@@ -91,7 +91,7 @@ class TranslationService extends BaseService_1.default {
|
|
|
91
91
|
],
|
|
92
92
|
};
|
|
93
93
|
try {
|
|
94
|
-
logger_1.default.info(
|
|
94
|
+
logger_1.default.info({ requestBody }, ':: TranslationServicee.findTextLanguage :: Finding text language ::');
|
|
95
95
|
const response = yield this.request.post('', requestBody);
|
|
96
96
|
return {
|
|
97
97
|
firstChoice: this.getResponseFirstChoice(response),
|
|
@@ -130,7 +130,7 @@ class TranslationService extends BaseService_1.default {
|
|
|
130
130
|
],
|
|
131
131
|
};
|
|
132
132
|
try {
|
|
133
|
-
logger_1.default.info(
|
|
133
|
+
logger_1.default.info({ requestBody }, ':: TranslationServicee.findTextLanguageBasedOnFrequency :: Finding text language ::');
|
|
134
134
|
const response = yield this.request.post('', requestBody);
|
|
135
135
|
return {
|
|
136
136
|
firstChoice: this.getResponseFirstChoice(response),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobrowser/chatgpt",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.24",
|
|
4
4
|
"description": "chatgpt services to connect our projects with chatgpt api",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chatgpt",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"bugs": {
|
|
41
41
|
"url": "https://bitbucket.org/cobrowser/cb_utils/issues"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "2899608b31aa2387ab0f6ca0cad30cd9b6469c00"
|
|
44
44
|
}
|