wechaty-web-panel 1.6.89 → 1.6.91
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/cjs/src/botInstance/sdk/difyClient.js +1 -0
- package/dist/cjs/src/package-json.js +3 -3
- package/dist/cjs/src/proxy/bot/dispatch.d.ts +1 -1
- package/dist/cjs/src/proxy/bot/dispatch.js +4 -4
- package/dist/cjs/src/service/event-dispatch-service.d.ts +1 -1
- package/dist/cjs/src/service/event-dispatch-service.js +4 -4
- package/dist/cjs/src/service/msg-filters.js +4 -2
- package/dist/esm/src/botInstance/sdk/difyClient.js +1 -0
- package/dist/esm/src/package-json.js +3 -3
- package/dist/esm/src/proxy/bot/dispatch.d.ts +1 -1
- package/dist/esm/src/proxy/bot/dispatch.js +4 -4
- package/dist/esm/src/service/event-dispatch-service.d.ts +1 -1
- package/dist/esm/src/service/event-dispatch-service.js +4 -4
- package/dist/esm/src/service/msg-filters.js +4 -2
- package/package.json +3 -3
- package/src/botInstance/sdk/difyClient.js +2 -1
- package/src/package-json.js +3 -3
- package/src/proxy/bot/dispatch.js +4 -4
- package/src/service/event-dispatch-service.js +4 -4
- package/src/service/msg-filters.js +4 -2
|
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
exports.packageJson = {
|
|
8
8
|
"name": "wechaty-web-panel",
|
|
9
|
-
"version": "1.6.
|
|
9
|
+
"version": "1.6.91",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"import": "./dist/esm/src/index.js",
|
|
@@ -53,13 +53,13 @@ exports.packageJson = {
|
|
|
53
53
|
"@langchain/openai": "^0.4.4",
|
|
54
54
|
"@langchain/redis": "^0.1.1",
|
|
55
55
|
"ali-oss": "^6.21.0",
|
|
56
|
-
"axios": "
|
|
56
|
+
"axios": "1.8.2",
|
|
57
57
|
"baidu-aip-sdk": "^4.16.10",
|
|
58
58
|
"dayjs": "^1.11.7",
|
|
59
59
|
"eventsource-parser": "^1.0.0",
|
|
60
60
|
"form-data": "^4.0.0",
|
|
61
61
|
"https-proxy-agent": "^5.0.1",
|
|
62
|
-
"jsonwebtoken": "^
|
|
62
|
+
"jsonwebtoken": "^9.0.2",
|
|
63
63
|
"keyv": "^4.5.2",
|
|
64
64
|
"langchain": "^0.3.19",
|
|
65
65
|
"mqtt": "^4.2.6",
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* @param {botType: 机器人类别, content: 消息内容, uid: 说话的用户id, updateId: 更新的用户id, adminId: 对话实例id,用于分割不同配置, config: 机器人配置}
|
|
4
4
|
* @returns
|
|
5
5
|
*/
|
|
6
|
-
export function dispatchBot({ botType, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }: any): Promise<any>;
|
|
6
|
+
export function dispatchBot({ botType, isMention, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }: any): Promise<any>;
|
|
7
7
|
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -18,7 +18,7 @@ const userDb_js_1 = require("../../db/userDb.js");
|
|
|
18
18
|
* @param {botType: 机器人类别, content: 消息内容, uid: 说话的用户id, updateId: 更新的用户id, adminId: 对话实例id,用于分割不同配置, config: 机器人配置}
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
|
-
async function dispatchBot({ botType, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }) {
|
|
21
|
+
async function dispatchBot({ botType, isMention, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }) {
|
|
22
22
|
console.log('进入定制机器人回复');
|
|
23
23
|
try {
|
|
24
24
|
const contactSelf = await (0, userDb_js_1.getUser)();
|
|
@@ -33,13 +33,13 @@ async function dispatchBot({ botType, userAlias, userWeixin, content, id, uid, u
|
|
|
33
33
|
case 8:
|
|
34
34
|
// dify ai
|
|
35
35
|
console.log('进入Dify聊天');
|
|
36
|
-
res = await (0, dify_js_1.getDifyAiReply)({ content, file, inputs: { uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
36
|
+
res = await (0, dify_js_1.getDifyAiReply)({ content, file, inputs: { isMention: isMention ? 1 : 0, uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
37
37
|
replys = res;
|
|
38
38
|
break;
|
|
39
39
|
case 9:
|
|
40
40
|
// fastGPT api
|
|
41
41
|
console.log('进入FastGPT聊天');
|
|
42
|
-
res = await (0, fastgpt_js_1.getFastGPTReply)({ content, file, variables: { uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
42
|
+
res = await (0, fastgpt_js_1.getFastGPTReply)({ content, file, variables: { isMention: isMention ? 1 : 0, uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
43
43
|
replys = res;
|
|
44
44
|
break;
|
|
45
45
|
case 11:
|
|
@@ -56,7 +56,7 @@ async function dispatchBot({ botType, userAlias, userWeixin, content, id, uid, u
|
|
|
56
56
|
case 12:
|
|
57
57
|
// coze v3 api
|
|
58
58
|
console.log('进入Coze V3聊天');
|
|
59
|
-
res = await (0, cozev3_js_1.getCozeV3AiReply)({ content, file, inputs: { uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
59
|
+
res = await (0, cozev3_js_1.getCozeV3AiReply)({ content, file, inputs: { isMention: isMention ? 1 : 0, uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
60
60
|
replys = res;
|
|
61
61
|
break;
|
|
62
62
|
case 13:
|
|
@@ -21,7 +21,7 @@ export function dispatchEventContent(that: any, eName: string, msg: string, name
|
|
|
21
21
|
* @param {*} name 发消息人
|
|
22
22
|
* @param {*} id 发消息人id
|
|
23
23
|
*/
|
|
24
|
-
export function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias, userWeixin, roomName, file }: any): Promise<any>;
|
|
24
|
+
export function dispatchAiBot({ bot, msg, name, id, isMention, uid, uname, roomId, userAlias, userWeixin, roomName, file }: any): Promise<any>;
|
|
25
25
|
export function dispatchSummerBot({ content, id, uid, uname, roomId, roomName, userAlias, userWeixin, config }: {
|
|
26
26
|
content: any;
|
|
27
27
|
id: any;
|
|
@@ -182,7 +182,7 @@ exports.dispatchEventContent = dispatchEventContent;
|
|
|
182
182
|
* @param {*} name 发消息人
|
|
183
183
|
* @param {*} id 发消息人id
|
|
184
184
|
*/
|
|
185
|
-
async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias, userWeixin, roomName, file }) {
|
|
185
|
+
async function dispatchAiBot({ bot, msg, name, id, isMention, uid, uname, roomId, userAlias, userWeixin, roomName, file }) {
|
|
186
186
|
try {
|
|
187
187
|
let res, replys;
|
|
188
188
|
const contactSelf = await (0, userDb_js_1.getUser)();
|
|
@@ -213,12 +213,12 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
|
|
|
213
213
|
break;
|
|
214
214
|
case 8:
|
|
215
215
|
// dify ai
|
|
216
|
-
res = await (0, difyAi_js_1.getDifyReply)({ content: msg, file, id, inputs: { fileUrl: file?.fileUrl, uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
|
|
216
|
+
res = await (0, difyAi_js_1.getDifyReply)({ content: msg, file, id, inputs: { isMention: isMention ? 1 : 0, fileUrl: file?.fileUrl, uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
|
|
217
217
|
replys = res;
|
|
218
218
|
break;
|
|
219
219
|
case 9:
|
|
220
220
|
// fast gpt
|
|
221
|
-
res = await (0, fastgpt_js_1.getFastGPTReply)({ content: msg, file }, id, { fileUrl: file?.fileUrl, uid, uname, ualias: userAlias, uweixin: userWeixin, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name });
|
|
221
|
+
res = await (0, fastgpt_js_1.getFastGPTReply)({ content: msg, file }, id, { isMention: isMention ? 1 : 0, fileUrl: file?.fileUrl, uid, uname, ualias: userAlias, uweixin: userWeixin, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name });
|
|
222
222
|
replys = res;
|
|
223
223
|
break;
|
|
224
224
|
case 11:
|
|
@@ -233,7 +233,7 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
|
|
|
233
233
|
break;
|
|
234
234
|
case 12:
|
|
235
235
|
// coze v3
|
|
236
|
-
res = await (0, cozeV3Ai_js_1.getCozeV3Reply)({ content: msg, file, id, inputs: { uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
|
|
236
|
+
res = await (0, cozeV3Ai_js_1.getCozeV3Reply)({ content: msg, file, id, inputs: { isMention: isMention ? 1 : 0, uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
|
|
237
237
|
replys = res;
|
|
238
238
|
break;
|
|
239
239
|
case 13:
|
|
@@ -177,12 +177,13 @@ async function callbackEvent({ that, msg, name, id, config, room, isMention }) {
|
|
|
177
177
|
uname: name,
|
|
178
178
|
roomId: (room && room.id) || '',
|
|
179
179
|
roomName: (room && topic) || '',
|
|
180
|
+
isMention: isMention ? 1 : 0,
|
|
180
181
|
word: msg
|
|
181
182
|
};
|
|
182
183
|
item.moreData &&
|
|
183
184
|
item.moreData.length &&
|
|
184
185
|
item.moreData.forEach((mItem) => {
|
|
185
|
-
if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName') {
|
|
186
|
+
if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName' && mItem.key !== 'isMention') {
|
|
186
187
|
data[mItem.key] = mItem.value;
|
|
187
188
|
}
|
|
188
189
|
});
|
|
@@ -279,7 +280,7 @@ async function robotMsg({ msg, name, id, config, isMention, roomName, userAlias,
|
|
|
279
280
|
let msgArr = []; // 返回的消息列表
|
|
280
281
|
if (config.autoReply) {
|
|
281
282
|
console.log('开启了机器人自动回复功能');
|
|
282
|
-
msgArr = await event_dispatch_service_js_1.default.dispatchAiBot({ bot: config.defaultBot, msg, name, userAlias, userWeixin, uname: name, uid: id, roomName: roomName || '', roomId: roomId || '', id: `${roomId ? roomId + '_' : ''}${id}`, file });
|
|
283
|
+
msgArr = await event_dispatch_service_js_1.default.dispatchAiBot({ bot: config.defaultBot, isMention, msg, name, userAlias, userWeixin, uname: name, uid: id, roomName: roomName || '', roomId: roomId || '', id: `${roomId ? roomId + '_' : ''}${id}`, file });
|
|
283
284
|
}
|
|
284
285
|
else {
|
|
285
286
|
console.log('没有开启机器人自动回复功能');
|
|
@@ -409,6 +410,7 @@ async function customChat({ msg, name, id, config, isMention, room, userAlias, u
|
|
|
409
410
|
config: finalConfig.botConfig,
|
|
410
411
|
uid: id,
|
|
411
412
|
uname: name,
|
|
413
|
+
isMention,
|
|
412
414
|
roomId,
|
|
413
415
|
userAlias,
|
|
414
416
|
userWeixin,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const packageJson = {
|
|
5
5
|
"name": "wechaty-web-panel",
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.91",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": "./dist/esm/src/index.js",
|
|
@@ -50,13 +50,13 @@ export const packageJson = {
|
|
|
50
50
|
"@langchain/openai": "^0.4.4",
|
|
51
51
|
"@langchain/redis": "^0.1.1",
|
|
52
52
|
"ali-oss": "^6.21.0",
|
|
53
|
-
"axios": "
|
|
53
|
+
"axios": "1.8.2",
|
|
54
54
|
"baidu-aip-sdk": "^4.16.10",
|
|
55
55
|
"dayjs": "^1.11.7",
|
|
56
56
|
"eventsource-parser": "^1.0.0",
|
|
57
57
|
"form-data": "^4.0.0",
|
|
58
58
|
"https-proxy-agent": "^5.0.1",
|
|
59
|
-
"jsonwebtoken": "^
|
|
59
|
+
"jsonwebtoken": "^9.0.2",
|
|
60
60
|
"keyv": "^4.5.2",
|
|
61
61
|
"langchain": "^0.3.19",
|
|
62
62
|
"mqtt": "^4.2.6",
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* @param {botType: 机器人类别, content: 消息内容, uid: 说话的用户id, updateId: 更新的用户id, adminId: 对话实例id,用于分割不同配置, config: 机器人配置}
|
|
4
4
|
* @returns
|
|
5
5
|
*/
|
|
6
|
-
export function dispatchBot({ botType, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }: any): Promise<any>;
|
|
6
|
+
export function dispatchBot({ botType, isMention, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }: any): Promise<any>;
|
|
7
7
|
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -12,7 +12,7 @@ import { getUser } from '../../db/userDb.js';
|
|
|
12
12
|
* @param {botType: 机器人类别, content: 消息内容, uid: 说话的用户id, updateId: 更新的用户id, adminId: 对话实例id,用于分割不同配置, config: 机器人配置}
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
|
-
export async function dispatchBot({ botType, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }) {
|
|
15
|
+
export async function dispatchBot({ botType, isMention, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }) {
|
|
16
16
|
console.log('进入定制机器人回复');
|
|
17
17
|
try {
|
|
18
18
|
const contactSelf = await getUser();
|
|
@@ -27,13 +27,13 @@ export async function dispatchBot({ botType, userAlias, userWeixin, content, id,
|
|
|
27
27
|
case 8:
|
|
28
28
|
// dify ai
|
|
29
29
|
console.log('进入Dify聊天');
|
|
30
|
-
res = await getDifyAiReply({ content, file, inputs: { uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
30
|
+
res = await getDifyAiReply({ content, file, inputs: { isMention: isMention ? 1 : 0, uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
31
31
|
replys = res;
|
|
32
32
|
break;
|
|
33
33
|
case 9:
|
|
34
34
|
// fastGPT api
|
|
35
35
|
console.log('进入FastGPT聊天');
|
|
36
|
-
res = await getFastGPTReply({ content, file, variables: { uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
36
|
+
res = await getFastGPTReply({ content, file, variables: { isMention: isMention ? 1 : 0, uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
37
37
|
replys = res;
|
|
38
38
|
break;
|
|
39
39
|
case 11:
|
|
@@ -50,7 +50,7 @@ export async function dispatchBot({ botType, userAlias, userWeixin, content, id,
|
|
|
50
50
|
case 12:
|
|
51
51
|
// coze v3 api
|
|
52
52
|
console.log('进入Coze V3聊天');
|
|
53
|
-
res = await getCozeV3AiReply({ content, file, inputs: { uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
53
|
+
res = await getCozeV3AiReply({ content, file, inputs: { isMention: isMention ? 1 : 0, uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
|
|
54
54
|
replys = res;
|
|
55
55
|
break;
|
|
56
56
|
case 13:
|
|
@@ -21,7 +21,7 @@ export function dispatchEventContent(that: any, eName: string, msg: string, name
|
|
|
21
21
|
* @param {*} name 发消息人
|
|
22
22
|
* @param {*} id 发消息人id
|
|
23
23
|
*/
|
|
24
|
-
export function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias, userWeixin, roomName, file }: any): Promise<any>;
|
|
24
|
+
export function dispatchAiBot({ bot, msg, name, id, isMention, uid, uname, roomId, userAlias, userWeixin, roomName, file }: any): Promise<any>;
|
|
25
25
|
export function dispatchSummerBot({ content, id, uid, uname, roomId, roomName, userAlias, userWeixin, config }: {
|
|
26
26
|
content: any;
|
|
27
27
|
id: any;
|
|
@@ -178,7 +178,7 @@ async function dispatchEventContent(that, eName, msg, name, id, avatar, room, ro
|
|
|
178
178
|
* @param {*} name 发消息人
|
|
179
179
|
* @param {*} id 发消息人id
|
|
180
180
|
*/
|
|
181
|
-
async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias, userWeixin, roomName, file }) {
|
|
181
|
+
async function dispatchAiBot({ bot, msg, name, id, isMention, uid, uname, roomId, userAlias, userWeixin, roomName, file }) {
|
|
182
182
|
try {
|
|
183
183
|
let res, replys;
|
|
184
184
|
const contactSelf = await getUser();
|
|
@@ -209,12 +209,12 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
|
|
|
209
209
|
break;
|
|
210
210
|
case 8:
|
|
211
211
|
// dify ai
|
|
212
|
-
res = await getDifyReply({ content: msg, file, id, inputs: { fileUrl: file?.fileUrl, uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
|
|
212
|
+
res = await getDifyReply({ content: msg, file, id, inputs: { isMention: isMention ? 1 : 0, fileUrl: file?.fileUrl, uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
|
|
213
213
|
replys = res;
|
|
214
214
|
break;
|
|
215
215
|
case 9:
|
|
216
216
|
// fast gpt
|
|
217
|
-
res = await getFastGPTReply({ content: msg, file }, id, { fileUrl: file?.fileUrl, uid, uname, ualias: userAlias, uweixin: userWeixin, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name });
|
|
217
|
+
res = await getFastGPTReply({ content: msg, file }, id, { isMention: isMention ? 1 : 0, fileUrl: file?.fileUrl, uid, uname, ualias: userAlias, uweixin: userWeixin, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name });
|
|
218
218
|
replys = res;
|
|
219
219
|
break;
|
|
220
220
|
case 11:
|
|
@@ -229,7 +229,7 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
|
|
|
229
229
|
break;
|
|
230
230
|
case 12:
|
|
231
231
|
// coze v3
|
|
232
|
-
res = await getCozeV3Reply({ content: msg, file, id, inputs: { uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
|
|
232
|
+
res = await getCozeV3Reply({ content: msg, file, id, inputs: { isMention: isMention ? 1 : 0, uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
|
|
233
233
|
replys = res;
|
|
234
234
|
break;
|
|
235
235
|
case 13:
|
|
@@ -165,12 +165,13 @@ async function callbackEvent({ that, msg, name, id, config, room, isMention }) {
|
|
|
165
165
|
uname: name,
|
|
166
166
|
roomId: (room && room.id) || '',
|
|
167
167
|
roomName: (room && topic) || '',
|
|
168
|
+
isMention: isMention ? 1 : 0,
|
|
168
169
|
word: msg
|
|
169
170
|
};
|
|
170
171
|
item.moreData &&
|
|
171
172
|
item.moreData.length &&
|
|
172
173
|
item.moreData.forEach((mItem) => {
|
|
173
|
-
if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName') {
|
|
174
|
+
if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName' && mItem.key !== 'isMention') {
|
|
174
175
|
data[mItem.key] = mItem.value;
|
|
175
176
|
}
|
|
176
177
|
});
|
|
@@ -264,7 +265,7 @@ async function robotMsg({ msg, name, id, config, isMention, roomName, userAlias,
|
|
|
264
265
|
let msgArr = []; // 返回的消息列表
|
|
265
266
|
if (config.autoReply) {
|
|
266
267
|
console.log('开启了机器人自动回复功能');
|
|
267
|
-
msgArr = await dispatch.dispatchAiBot({ bot: config.defaultBot, msg, name, userAlias, userWeixin, uname: name, uid: id, roomName: roomName || '', roomId: roomId || '', id: `${roomId ? roomId + '_' : ''}${id}`, file });
|
|
268
|
+
msgArr = await dispatch.dispatchAiBot({ bot: config.defaultBot, isMention, msg, name, userAlias, userWeixin, uname: name, uid: id, roomName: roomName || '', roomId: roomId || '', id: `${roomId ? roomId + '_' : ''}${id}`, file });
|
|
268
269
|
}
|
|
269
270
|
else {
|
|
270
271
|
console.log('没有开启机器人自动回复功能');
|
|
@@ -392,6 +393,7 @@ async function customChat({ msg, name, id, config, isMention, room, userAlias, u
|
|
|
392
393
|
config: finalConfig.botConfig,
|
|
393
394
|
uid: id,
|
|
394
395
|
uname: name,
|
|
396
|
+
isMention,
|
|
395
397
|
roomId,
|
|
396
398
|
userAlias,
|
|
397
399
|
userWeixin,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wechaty-web-panel",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.91",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./dist/esm/src/index.js",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@langchain/openai": "^0.4.4",
|
|
48
48
|
"@langchain/redis": "^0.1.1",
|
|
49
49
|
"ali-oss": "^6.21.0",
|
|
50
|
-
"axios": "
|
|
50
|
+
"axios": "1.8.2",
|
|
51
51
|
"baidu-aip-sdk": "^4.16.10",
|
|
52
52
|
"dayjs": "^1.11.7",
|
|
53
53
|
"eventsource-parser": "^1.0.0",
|
|
54
54
|
"form-data": "^4.0.0",
|
|
55
55
|
"https-proxy-agent": "^5.0.1",
|
|
56
|
-
"jsonwebtoken": "^
|
|
56
|
+
"jsonwebtoken": "^9.0.2",
|
|
57
57
|
"keyv": "^4.5.2",
|
|
58
58
|
"langchain": "^0.3.19",
|
|
59
59
|
"mqtt": "^4.2.6",
|
|
@@ -125,7 +125,8 @@ export class DifyClient {
|
|
|
125
125
|
if(stream && e.response) {
|
|
126
126
|
const errorText = await this.streamToString(e.response.data);
|
|
127
127
|
return Promise.reject(errorText)
|
|
128
|
-
}
|
|
128
|
+
}
|
|
129
|
+
console.log('error', e.response.data);
|
|
129
130
|
return Promise.reject(e)
|
|
130
131
|
}
|
|
131
132
|
}
|
package/src/package-json.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const packageJson = {
|
|
5
5
|
"name": "wechaty-web-panel",
|
|
6
|
-
"version": "1.6.
|
|
6
|
+
"version": "1.6.91",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": "./dist/esm/src/index.js",
|
|
@@ -50,13 +50,13 @@ export const packageJson = {
|
|
|
50
50
|
"@langchain/openai": "^0.4.4",
|
|
51
51
|
"@langchain/redis": "^0.1.1",
|
|
52
52
|
"ali-oss": "^6.21.0",
|
|
53
|
-
"axios": "
|
|
53
|
+
"axios": "1.8.2",
|
|
54
54
|
"baidu-aip-sdk": "^4.16.10",
|
|
55
55
|
"dayjs": "^1.11.7",
|
|
56
56
|
"eventsource-parser": "^1.0.0",
|
|
57
57
|
"form-data": "^4.0.0",
|
|
58
58
|
"https-proxy-agent": "^5.0.1",
|
|
59
|
-
"jsonwebtoken": "^
|
|
59
|
+
"jsonwebtoken": "^9.0.2",
|
|
60
60
|
"keyv": "^4.5.2",
|
|
61
61
|
"langchain": "^0.3.19",
|
|
62
62
|
"mqtt": "^4.2.6",
|
|
@@ -13,7 +13,7 @@ import { getUser } from '../../db/userDb.js'
|
|
|
13
13
|
* @param {botType: 机器人类别, content: 消息内容, uid: 说话的用户id, updateId: 更新的用户id, adminId: 对话实例id,用于分割不同配置, config: 机器人配置}
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
|
-
export async function dispatchBot({ botType, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }) {
|
|
16
|
+
export async function dispatchBot({ botType, isMention, userAlias, userWeixin, content, id, uid, uname, roomId, roomName, adminId, config, file }) {
|
|
17
17
|
console.log('进入定制机器人回复')
|
|
18
18
|
try {
|
|
19
19
|
const contactSelf = await getUser()
|
|
@@ -28,13 +28,13 @@ export async function dispatchBot({ botType, userAlias, userWeixin, content, id,
|
|
|
28
28
|
case 8:
|
|
29
29
|
// dify ai
|
|
30
30
|
console.log('进入Dify聊天')
|
|
31
|
-
res = await getDifyAiReply({ content, file, inputs: { uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config)
|
|
31
|
+
res = await getDifyAiReply({ content, file, inputs: { isMention: isMention ? 1:0, uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config)
|
|
32
32
|
replys = res
|
|
33
33
|
break
|
|
34
34
|
case 9:
|
|
35
35
|
// fastGPT api
|
|
36
36
|
console.log('进入FastGPT聊天')
|
|
37
|
-
res = await getFastGPTReply({ content, file, variables: { uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config)
|
|
37
|
+
res = await getFastGPTReply({ content, file, variables: { isMention: isMention ? 1:0, uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config)
|
|
38
38
|
replys = res
|
|
39
39
|
break
|
|
40
40
|
case 11:
|
|
@@ -50,7 +50,7 @@ export async function dispatchBot({ botType, userAlias, userWeixin, content, id,
|
|
|
50
50
|
case 12:
|
|
51
51
|
// coze v3 api
|
|
52
52
|
console.log('进入Coze V3聊天')
|
|
53
|
-
res = await getCozeV3AiReply({ content, file, inputs: { uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config)
|
|
53
|
+
res = await getCozeV3AiReply({ content, file, inputs: { isMention: isMention ? 1:0, uid, fileUrl: file?.fileUrl, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config)
|
|
54
54
|
replys = res
|
|
55
55
|
break
|
|
56
56
|
case 13:
|
|
@@ -178,7 +178,7 @@ async function dispatchEventContent(that, eName, msg, name, id, avatar, room, ro
|
|
|
178
178
|
* @param {*} name 发消息人
|
|
179
179
|
* @param {*} id 发消息人id
|
|
180
180
|
*/
|
|
181
|
-
async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias, userWeixin, roomName, file }) {
|
|
181
|
+
async function dispatchAiBot({ bot, msg, name, id, isMention, uid, uname, roomId, userAlias, userWeixin, roomName, file }) {
|
|
182
182
|
try {
|
|
183
183
|
let res, replys
|
|
184
184
|
const contactSelf = await getUser()
|
|
@@ -207,12 +207,12 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
|
|
|
207
207
|
break
|
|
208
208
|
case 8:
|
|
209
209
|
// dify ai
|
|
210
|
-
res = await getDifyReply({ content: msg, file, id, inputs: { fileUrl: file?.fileUrl, uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } })
|
|
210
|
+
res = await getDifyReply({ content: msg, file, id, inputs: { isMention: isMention ? 1:0, fileUrl: file?.fileUrl, uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } })
|
|
211
211
|
replys = res
|
|
212
212
|
break
|
|
213
213
|
case 9:
|
|
214
214
|
// fast gpt
|
|
215
|
-
res = await getFastGPTReply({ content: msg, file }, id, { fileUrl: file?.fileUrl, uid, uname, ualias: userAlias, uweixin: userWeixin, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name })
|
|
215
|
+
res = await getFastGPTReply({ content: msg, file }, id, { isMention: isMention ? 1:0, fileUrl: file?.fileUrl, uid, uname, ualias: userAlias, uweixin: userWeixin, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name })
|
|
216
216
|
replys = res
|
|
217
217
|
break
|
|
218
218
|
case 11:
|
|
@@ -226,7 +226,7 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
|
|
|
226
226
|
break
|
|
227
227
|
case 12:
|
|
228
228
|
// coze v3
|
|
229
|
-
res = await getCozeV3Reply({ content: msg, file, id, inputs: { uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } })
|
|
229
|
+
res = await getCozeV3Reply({ content: msg, file, id, inputs: { isMention: isMention ? 1:0, uid, ualias: userAlias, uweixin: userWeixin, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } })
|
|
230
230
|
replys = res
|
|
231
231
|
break
|
|
232
232
|
case 13:
|
|
@@ -165,12 +165,13 @@ async function callbackEvent({ that, msg, name, id, config, room, isMention }) {
|
|
|
165
165
|
uname: name,
|
|
166
166
|
roomId: (room && room.id) || '',
|
|
167
167
|
roomName: (room && topic) || '',
|
|
168
|
+
isMention: isMention ? 1 : 0,
|
|
168
169
|
word: msg
|
|
169
170
|
}
|
|
170
171
|
item.moreData &&
|
|
171
172
|
item.moreData.length &&
|
|
172
173
|
item.moreData.forEach((mItem) => {
|
|
173
|
-
if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName') {
|
|
174
|
+
if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName' && mItem.key !== 'isMention') {
|
|
174
175
|
data[mItem.key] = mItem.value
|
|
175
176
|
}
|
|
176
177
|
})
|
|
@@ -260,7 +261,7 @@ async function robotMsg({ msg, name, id, config, isMention, roomName, userAlias
|
|
|
260
261
|
let msgArr = [] // 返回的消息列表
|
|
261
262
|
if (config.autoReply) {
|
|
262
263
|
console.log('开启了机器人自动回复功能')
|
|
263
|
-
msgArr = await dispatch.dispatchAiBot({ bot: config.defaultBot, msg, name, userAlias, userWeixin, uname: name, uid: id, roomName: roomName || '', roomId: roomId || '', id: `${roomId ? roomId + '_' : ''}${id}`, file })
|
|
264
|
+
msgArr = await dispatch.dispatchAiBot({ bot: config.defaultBot, isMention, msg, name, userAlias, userWeixin, uname: name, uid: id, roomName: roomName || '', roomId: roomId || '', id: `${roomId ? roomId + '_' : ''}${id}`, file })
|
|
264
265
|
} else {
|
|
265
266
|
console.log('没有开启机器人自动回复功能')
|
|
266
267
|
msgArr = [{ type: 1, content: '', url: '' }]
|
|
@@ -382,6 +383,7 @@ async function customChat({ msg, name, id, config, isMention, room, userAlias, u
|
|
|
382
383
|
config: finalConfig.botConfig,
|
|
383
384
|
uid: id,
|
|
384
385
|
uname: name,
|
|
386
|
+
isMention,
|
|
385
387
|
roomId,
|
|
386
388
|
userAlias,
|
|
387
389
|
userWeixin,
|