@cobrowser/chatgpt 0.7.28 → 0.7.30
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/constants.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export declare const DEFAULT_PROMPT = "\n You are a helpful assistant. Your rol
|
|
|
10
10
|
export declare const DESTINATION_LANGUAGE = "English";
|
|
11
11
|
export declare const LANGUAGE_DETECTION_SYSTEM_ROLE = "\n You are a language detection assistant. Your task is to analyze short text input and determine \n its language using ISO language code. Respond only in JSON format with two key-value pairs: \n - 'languageCode': the detected language's ISO code (or undefined if detection fails).\n - 'isError': a boolean value (true if detection fails, false otherwise).\n";
|
|
12
12
|
export declare const WORD_FREQUENCY_LANGUAGE_DETECTION_SYSTEM_ROLE = "\n You are a language detection assistant. Your task is to analyze the most frequently occurring words in the given text \n and determine the language based on those words. Respond only in JSON format with two key-value pairs: \n - 'languageCode': the detected language's ISO code (or undefined if detection fails).\n - 'isError': a boolean value (true if detection fails, false otherwise).\n";
|
|
13
|
-
export declare const TRANSLATION_SYSTEM_ROLE = "\n You are a translator that responds exclusively in JSON format. Your response must be a JSON object containing:\n - 'data': it is an array of objects. Each object in the array must contain:\n - 'translated_message': The original input message before translation.\n - 'translation: The translated version of 'translated_message', ensuring it is natural, culturally appropriate, and commonly used by native speakers.\n - 'isError': a boolean value (true if translation fails, false otherwise).\n\n Ensure that 'translation' accurately represents the meaning of 'translated_message' while considering cultural nuances, usual expressions, and natural phrasing in the target language
|
|
13
|
+
export declare const TRANSLATION_SYSTEM_ROLE = "\n You are a translator that responds exclusively in JSON format. Your response must be a JSON object containing:\n - 'data': it is an array of objects. Each object in the array must contain:\n - 'translated_message': The original input message before translation.\n - 'translation: The translated version of 'translated_message', ensuring it is natural, culturally appropriate, and commonly used by native speakers.\n - 'isError': a boolean value (true if translation fails, false otherwise).\n\n **You MUST return the JSON format even if you fail to translate the text. In this case, data field will be empty array and isError should be true.** \n\n Ensure that 'translation' accurately represents the meaning of 'translated_message' while considering cultural nuances, usual expressions, and natural phrasing in the target language.\n\n Your response must follow this structure strictly.\n";
|
package/dist/constants.js
CHANGED
|
@@ -58,6 +58,9 @@ exports.TRANSLATION_SYSTEM_ROLE = `
|
|
|
58
58
|
- 'translation: The translated version of 'translated_message', ensuring it is natural, culturally appropriate, and commonly used by native speakers.
|
|
59
59
|
- 'isError': a boolean value (true if translation fails, false otherwise).
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
**You MUST return the JSON format even if you fail to translate the text. In this case, data field will be empty array and isError should be true.**
|
|
62
|
+
|
|
63
|
+
Ensure that 'translation' accurately represents the meaning of 'translated_message' while considering cultural nuances, usual expressions, and natural phrasing in the target language.
|
|
64
|
+
|
|
62
65
|
Your response must follow this structure strictly.
|
|
63
66
|
`;
|
|
@@ -106,7 +106,6 @@ class BaseService {
|
|
|
106
106
|
* @param data
|
|
107
107
|
*/
|
|
108
108
|
output(data, shouldStringify = false) {
|
|
109
|
-
console.log('DATA: ', data);
|
|
110
109
|
if (!data) {
|
|
111
110
|
return;
|
|
112
111
|
}
|
|
@@ -118,8 +117,6 @@ class BaseService {
|
|
|
118
117
|
catch (error) { }
|
|
119
118
|
}
|
|
120
119
|
const sanitized = xss_validation_1.XSSProtector.sanitize(data), encoded = xss_validation_1.XSSProtector.encode(sanitized);
|
|
121
|
-
console.log('sanitized: ', sanitized);
|
|
122
|
-
console.log('encoded: ', encoded);
|
|
123
120
|
logger_1.default.info({ data, sanitized, encoded }, ':: Sanitized Response ::');
|
|
124
121
|
return shouldStringify ? JSON.stringify(encoded) : encoded;
|
|
125
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobrowser/chatgpt",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.30",
|
|
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": "c8747e61dff13093fa0593dd4a3219ff11eb7b82"
|
|
44
44
|
}
|