doomiaichat 1.3.0 → 1.4.0
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 +3 -3
- package/package.json +1 -1
- package/src/index.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -49,11 +49,11 @@ class AIChat extends events_1.EventEmitter {
|
|
|
49
49
|
[{ role: 'system', content: chatText + '' }] : chatText;
|
|
50
50
|
try {
|
|
51
51
|
const response = yield this.chatRobot.createChatCompletion({
|
|
52
|
-
model: callChatOption.model || this.chatModel,
|
|
52
|
+
model: (callChatOption === null || callChatOption === void 0 ? void 0 : callChatOption.model) || this.chatModel,
|
|
53
53
|
messages: message,
|
|
54
54
|
temperature: (callChatOption === null || callChatOption === void 0 ? void 0 : callChatOption.temperature) || this.temperature,
|
|
55
55
|
max_tokens: (callChatOption === null || callChatOption === void 0 ? void 0 : callChatOption.maxtoken) || this.maxtoken,
|
|
56
|
-
n: callChatOption.replyCounts || 1
|
|
56
|
+
n: (callChatOption === null || callChatOption === void 0 ? void 0 : callChatOption.replyCounts) || 1
|
|
57
57
|
}, axiosOption);
|
|
58
58
|
return { successed: true, message: response.data.choices };
|
|
59
59
|
}
|
|
@@ -106,7 +106,7 @@ class AIChat extends events_1.EventEmitter {
|
|
|
106
106
|
let value = result.message[0].message.content.replace(/[^\d]/g, "");
|
|
107
107
|
if (value > 100)
|
|
108
108
|
value = Math.floor(value / 10);
|
|
109
|
-
return { successed: true, value };
|
|
109
|
+
return { successed: true, value: Number(value) };
|
|
110
110
|
}
|
|
111
111
|
return { successed: false, error: result.error, value: 0 };
|
|
112
112
|
});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -43,11 +43,11 @@ export class AIChat extends EventEmitter {
|
|
|
43
43
|
try {
|
|
44
44
|
const response: AxiosResponse<CreateChatCompletionResponse, any>
|
|
45
45
|
= await this.chatRobot.createChatCompletion({
|
|
46
|
-
model: callChatOption
|
|
46
|
+
model: callChatOption?.model || this.chatModel,
|
|
47
47
|
messages: message,
|
|
48
48
|
temperature: callChatOption?.temperature || this.temperature,
|
|
49
49
|
max_tokens: callChatOption?.maxtoken || this.maxtoken,
|
|
50
|
-
n: callChatOption
|
|
50
|
+
n: callChatOption?.replyCounts || 1
|
|
51
51
|
}, axiosOption);
|
|
52
52
|
return {successed:true,message: response.data.choices};
|
|
53
53
|
} catch (error) {
|
|
@@ -95,7 +95,7 @@ export class AIChat extends EventEmitter {
|
|
|
95
95
|
if (result.successed && result.message){
|
|
96
96
|
let value = result.message[0].message.content.replace(/[^\d]/g, "")
|
|
97
97
|
if (value > 100) value = Math.floor(value / 10);
|
|
98
|
-
return { successed: true, value };
|
|
98
|
+
return { successed: true, value:Number(value) };
|
|
99
99
|
}
|
|
100
100
|
return { successed: false, error:result.error,value:0 };
|
|
101
101
|
|