@cobrowser/chatgpt 0.3.0 → 0.4.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/dist/index.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -41,7 +41,7 @@ class BaseService {
41
41
  baseURL: apiUrl || this.BASE_CHAT_COMPLETION_URL,
42
42
  headers: {
43
43
  'Content-Type': 'application/json',
44
- Authorization: `Bearer ${process.env.OPEN_API_KEY} `,
44
+ Authorization: `Bearer ${process.env.OPEN_AI_API_KEY} `,
45
45
  },
46
46
  });
47
47
  this.chatGptModel = model;
@@ -32,13 +32,13 @@ class TranslationService extends BaseService_1.default {
32
32
  * @param toLanguage the desired language to translate to ( English is the default )
33
33
  * @param fromLanguage if we want to specify the language of the text, we can use this ( optional)
34
34
  */
35
- translate(text, toLanguage = 'English', fromLanguage) {
35
+ translate(text, toLanguage = this.DESTINATION_LANGUAGE, fromLanguage) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
37
  if (!text) {
38
38
  logger_1.default.error('translation text should be provided');
39
39
  return Promise.reject(new Error('test must be provided'));
40
40
  }
41
- const desiredLanguage = toLanguage || this.DESTINATION_LANGUAGE,
41
+ const desiredLanguage = toLanguage,
42
42
  // instruction on what to do with the text
43
43
  translateText = `Translate the following ${fromLanguage} text to ${desiredLanguage}: ${text}`,
44
44
  // the body we need to send to the request
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobrowser/chatgpt",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "chatgpt services to connect our projects with chatgpt api",
5
5
  "keywords": [
6
6
  "chatgpt",
@@ -38,5 +38,5 @@
38
38
  "bugs": {
39
39
  "url": "https://bitbucket.org/cobrowser/cb_utils/issues"
40
40
  },
41
- "gitHead": "baf55dda6e634a5d95b08ed0b8c6d10793353e7b"
41
+ "gitHead": "77659f6a9a47d7199bc70985aad19ac8e7616355"
42
42
  }