@cobrowser/chatgpt 0.7.42-beta.1 → 0.7.42
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.
|
@@ -63,7 +63,14 @@ class CopilotService extends BaseService_1.default {
|
|
|
63
63
|
*/
|
|
64
64
|
suggest(conversation, suggestionLanguage) {
|
|
65
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
logger_1.default.info({
|
|
66
|
+
logger_1.default.info({
|
|
67
|
+
suggestionLanguage,
|
|
68
|
+
conversation,
|
|
69
|
+
model: this.chatGPTModel,
|
|
70
|
+
threadId: this.threadId,
|
|
71
|
+
assistantId: this.assistantId,
|
|
72
|
+
conversationId: this.conversationId,
|
|
73
|
+
}, ':: CopilotServicee.suggest :: Fetching suggestions... ::');
|
|
67
74
|
if (!(conversation === null || conversation === void 0 ? void 0 : conversation.length)) {
|
|
68
75
|
logger_1.default.error('Conversation must be provided');
|
|
69
76
|
return Promise.reject(new Error('Conversation must be provided'));
|
|
@@ -80,10 +87,13 @@ class CopilotService extends BaseService_1.default {
|
|
|
80
87
|
}
|
|
81
88
|
// Route based on id shape: asst_* => Assistant API, prompt_* => Responses API
|
|
82
89
|
if (yield this.isAssistantIdFormat(this.assistantId)) {
|
|
90
|
+
logger_1.default.info(':: CopilotServicee.suggest :: Fetching suggestion through Assistant API ::');
|
|
83
91
|
return yield this.getAssistantSuggestions(conversation, suggestionLanguage);
|
|
84
92
|
}
|
|
93
|
+
logger_1.default.info(':: CopilotServicee.suggest :: Fetching suggestion through Responses API ::');
|
|
85
94
|
return yield this.getPromptSuggestions(conversation, suggestionLanguage);
|
|
86
95
|
}
|
|
96
|
+
logger_1.default.info(':: CopilotServicee.suggest :: Fetching suggestion through Chat Completion API ::');
|
|
87
97
|
return yield this.getChatCompletionSuggestions(conversation, suggestionLanguage);
|
|
88
98
|
}
|
|
89
99
|
catch (e) {
|
|
@@ -35,8 +35,14 @@ class TranslationService extends BaseService_1.default {
|
|
|
35
35
|
logger_1.default.error('Translation text should be provided');
|
|
36
36
|
return Promise.reject(new Error('Text must be provided'));
|
|
37
37
|
}
|
|
38
|
+
logger_1.default.info({
|
|
39
|
+
text,
|
|
40
|
+
toLanguage,
|
|
41
|
+
fromLanguage,
|
|
42
|
+
additionalInstructions,
|
|
43
|
+
}, ':: TranslationServicee.translate :: Translation Data ::');
|
|
38
44
|
const translateText = `
|
|
39
|
-
Translate the following text
|
|
45
|
+
Translate the following text to ${toLanguage} if it's not already in ${toLanguage}: ${text}.
|
|
40
46
|
`;
|
|
41
47
|
const requestBody = {
|
|
42
48
|
model: this.chatGPTModel,
|
|
@@ -6,7 +6,7 @@ export declare const MESSAGE_TYPES: {
|
|
|
6
6
|
text: string;
|
|
7
7
|
button: string;
|
|
8
8
|
};
|
|
9
|
-
export declare const DEFAULT_MODEL = "gpt-5
|
|
9
|
+
export declare const DEFAULT_MODEL = "gpt-5-nano";
|
|
10
10
|
export declare const DEFAULT_PROMPT = "\n You are a helpful assistant. Your role is to address visitor \n queries related to the ongoing conversation and the last message received. Please ensure \n that responses remain within the ongoing conversation. Politely decline any user queries \n that is not present in the ongoing conversation. \n\n You will always respond with a JSON. It will be in the format: \n\n { answer: '', suggestions: [], connectWithAgent: true or false }\n\n Fields in the JSON:\n\n Answer: It will consist of the user's query answer based on the ongoing conversation. \n Restrict this field to 100 characters.\n\n Suggestions: Request 2 suggestions from user's perspective that he can ask. \n It should be an array of strings. Restrict each suggestion to 50 characters.\n \n ConnectWithAgent: It is a boolean. It should be set to true if the user's query is \n not found in the ongoing conversation. Politely tell the user to talk to a real agent. \n Also when it is true, do not provide any suggestions.\n";
|
|
11
11
|
export declare const DESTINATION_LANGUAGE = "English";
|
|
12
12
|
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";
|
package/dist/utils/constants.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.MESSAGE_TYPES = {
|
|
|
11
11
|
text: 'text',
|
|
12
12
|
button: 'button'
|
|
13
13
|
};
|
|
14
|
-
exports.DEFAULT_MODEL = 'gpt-5
|
|
14
|
+
exports.DEFAULT_MODEL = 'gpt-5-nano';
|
|
15
15
|
// Default prompt for ChatGPT
|
|
16
16
|
exports.DEFAULT_PROMPT = `
|
|
17
17
|
You are a helpful assistant. Your role is to address visitor
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobrowser/chatgpt",
|
|
3
|
-
"version": "0.7.42
|
|
3
|
+
"version": "0.7.42",
|
|
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": "2d994b9a9cf3c441e1b0fcc3ade49cfd36c913e3"
|
|
44
44
|
}
|