@cobrowser/chatgpt 0.6.2 → 0.6.4
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.
|
@@ -48,7 +48,7 @@ class TranslationService extends BaseService_1.default {
|
|
|
48
48
|
messages: [
|
|
49
49
|
{
|
|
50
50
|
role: ChatGptMessage_1.ChatGptRole.SYSTEM,
|
|
51
|
-
content:
|
|
51
|
+
content: "You are a translator that provides a response in JSON format only. The response should be a JSON object with a boolean called 'error' and 'data,' which is an array of objects. Each object in the array will contain a 'translation' property, holding the translation of the message, and a 'translated_message' property, which will contain the original message before being translated. Additionally, the 'translation' property will hold the translation of the 'translated_message' property.",
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
role: ChatGptMessage_1.ChatGptRole.USER,
|
|
@@ -76,16 +76,14 @@ class TranslationService extends BaseService_1.default {
|
|
|
76
76
|
return Promise.reject(new Error('text must be provided'));
|
|
77
77
|
}
|
|
78
78
|
// instruction on what to do with the text
|
|
79
|
-
const translateText = `In which language is this text in '${text}'
|
|
80
|
-
{"languageCode": "Code_here", "isError": 'true or false based on if you did fine the language code or not'}
|
|
81
|
-
other responses or explanation are not allowed `,
|
|
79
|
+
const translateText = `In which language is this text in '${text}'? The response should be {'languageCode': 'language_code_here', 'isError': 'true or false based on whether you did find the language code or not'}. Other responses or explanations are not allowed.`,
|
|
82
80
|
// the body we need to send to the request
|
|
83
81
|
requestBody = {
|
|
84
82
|
model: this.chatGptModel,
|
|
85
83
|
messages: [
|
|
86
84
|
{
|
|
87
85
|
role: ChatGptMessage_1.ChatGptRole.SYSTEM,
|
|
88
|
-
content:
|
|
86
|
+
content: "You are a translator that provides a response in JSON format only—a JSON that contains 'languageCode' and 'isError' if you cannot detect the language.",
|
|
89
87
|
},
|
|
90
88
|
{
|
|
91
89
|
role: ChatGptMessage_1.ChatGptRole.USER,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobrowser/chatgpt",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
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": "
|
|
41
|
+
"gitHead": "0d2b7809e9ec1456985f4f7ecf30f43632fbf75b"
|
|
42
42
|
}
|