wechaty-web-panel 1.6.65 → 1.6.67

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/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## 更新日志
2
2
 
3
+ ### V1.6.66(2024-10-25)
4
+ 1、修复发送消息问题
5
+
3
6
  ### V1.6.62(2024-08-27)
4
7
  1、修复群消息总结CozeV3 渠道无法使用
5
8
 
@@ -14,6 +14,7 @@ const configDb_js_1 = require("../db/configDb.js");
14
14
  const puppet_type_js_1 = require("../const/puppet-type.js");
15
15
  const dayjs_1 = __importDefault(require("dayjs"));
16
16
  const chatHistory_js_1 = require("../db/chatHistory.js");
17
+ const puppetDb_js_1 = require("../db/puppetDb.js");
17
18
  async function formatContent(text) {
18
19
  text = text.replaceAll('\\n', '\n');
19
20
  const isWin = await (0, puppet_type_js_1.isWindowsPlatform)();
@@ -300,9 +301,17 @@ async function roomSay(room, contact, msg) {
300
301
  else if (msg.type === 8 && msg.url && msg.voiceLength) {
301
302
  const fileBox = file_box_1.FileBox.fromUrl(msg.url);
302
303
  fileBox.mimeType = "audio/silk";
303
- fileBox.metadata = {
304
- voiceLength: msg.voiceLength,
305
- };
304
+ const puppetInfo = await (0, puppetDb_js_1.getPuppetInfo)();
305
+ if (puppetInfo.puppetType === 'PuppetService') {
306
+ fileBox.metadata = {
307
+ duration: msg.voiceLength / 1000,
308
+ };
309
+ }
310
+ else {
311
+ fileBox.metadata = {
312
+ voiceLength: msg.voiceLength,
313
+ };
314
+ }
306
315
  await room.say(fileBox);
307
316
  }
308
317
  }
@@ -377,9 +386,17 @@ async function contactSay(contact, msg, isRoom = false) {
377
386
  else if (msg.type === 8 && msg.url && msg.voiceLength) {
378
387
  const fileBox = file_box_1.FileBox.fromUrl(msg.url);
379
388
  fileBox.mimeType = "audio/silk";
380
- fileBox.metadata = {
381
- voiceLength: msg.voiceLength,
382
- };
389
+ const puppetInfo = await (0, puppetDb_js_1.getPuppetInfo)();
390
+ if (puppetInfo.puppetType === 'PuppetService') {
391
+ fileBox.metadata = {
392
+ duration: msg.voiceLength / 1000,
393
+ };
394
+ }
395
+ else {
396
+ fileBox.metadata = {
397
+ voiceLength: msg.voiceLength,
398
+ };
399
+ }
383
400
  await contact.say(fileBox);
384
401
  }
385
402
  }
@@ -23,6 +23,7 @@ export namespace PUPPET_MAP {
23
23
  const PuppetOICQ: string;
24
24
  const PuppetLark: string;
25
25
  const PuppetService: string;
26
+ const PuppetMatrix: string;
26
27
  }
27
28
  export const WRAP_REPLACE_PUPPET: string[];
28
29
  export const SEND_APP_MSG_PUPPET: string[];
@@ -28,6 +28,7 @@ exports.PUPPET_MAP = {
28
28
  // https://github.com/wechaty/puppet-lark
29
29
  'PuppetLark': '飞书协议',
30
30
  'PuppetService': '企微协议',
31
+ 'PuppetMatrix': 'ipad协议',
31
32
  };
32
33
  // 需要处理换行的puppet 主要是 windows 平台下需要把\n 换成\r\n
33
34
  exports.WRAP_REPLACE_PUPPET = [
@@ -43,6 +43,7 @@ function checkIgnore(msg, list) {
43
43
  async function dispatchFriendFilterByMsgType(that, msg) {
44
44
  try {
45
45
  const eol = await (0, puppet_type_js_1.getPuppetEol)();
46
+ const puppetInfo = await (0, puppetDb_js_1.getPuppetInfo)();
46
47
  const aibotConfig = await (0, aiDb_js_1.getAibotConfig)();
47
48
  const config = await (0, configDb_js_1.allConfig)();
48
49
  const type = msg.type();
@@ -57,6 +58,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
57
58
  return;
58
59
  }
59
60
  switch (type) {
61
+ case that.Message.Type.System:
60
62
  case that.Message.Type.Text:
61
63
  case that.Message.Type.Url:
62
64
  if (type === that.Message.Type.Url) {
@@ -69,6 +71,15 @@ async function dispatchFriendFilterByMsgType(that, msg) {
69
71
  console.log('urlLink', urlLink);
70
72
  content = `[链接]:${urlLink.url()}`;
71
73
  }
74
+ else if (type === that.Message.Type.System) {
75
+ const stext = msg.text();
76
+ if ((stext.includes('你已添加') || stext.includes('You have added')) && puppetInfo.puppetType === 'PuppetMatrix') {
77
+ content = msg.text();
78
+ }
79
+ else {
80
+ return;
81
+ }
82
+ }
72
83
  else {
73
84
  content = msg.text();
74
85
  }
@@ -106,7 +117,6 @@ async function dispatchFriendFilterByMsgType(that, msg) {
106
117
  }
107
118
  break;
108
119
  case that.Message.Type.Audio:
109
- const puppetInfo = await (0, puppetDb_js_1.getPuppetInfo)();
110
120
  let finalConfig = await (0, msg_filters_js_1.getCustomConfig)({ name, id: contact.id, roomName: '', roomId: '', room: false, type: 'openWhisper' });
111
121
  if (!finalConfig && config?.customBot?.openWhisper) {
112
122
  finalConfig = {
@@ -46,6 +46,7 @@ export namespace packageJson {
46
46
  "eslint-plugin-prettier": string;
47
47
  "npm-run-all": string;
48
48
  prettier: string;
49
+ "wechaty-puppet-matrix": string;
49
50
  "wechaty-puppet-wechat4u": string;
50
51
  };
51
52
  const readme: string;
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
6
6
  */
7
7
  exports.packageJson = {
8
8
  "name": "wechaty-web-panel",
9
- "version": "1.6.65",
9
+ "version": "1.6.67",
10
10
  "description": "智能微秘书插件",
11
11
  "exports": {
12
12
  ".": {
@@ -67,6 +67,7 @@ exports.packageJson = {
67
67
  "eslint-plugin-prettier": "^3.1.4",
68
68
  "npm-run-all": "^4.1.5",
69
69
  "prettier": "^2.0.5",
70
+ "wechaty-puppet-matrix": "^0.0.8",
70
71
  "wechaty-puppet-wechat4u": "^1.14.12"
71
72
  },
72
73
  "readme": "README.md",
@@ -216,6 +216,7 @@ async function getConfig() {
216
216
  }
217
217
  let cres = await (0, configDb_js_1.updateConfig)({
218
218
  puppetType: 'wechaty-puppet-wechat',
219
+ no_remind: false,
219
220
  botScope: 'all',
220
221
  parseMini: false,
221
222
  openaiSystemMessage: '',
@@ -11,6 +11,7 @@ const cozev3_js_1 = require("./cozev3.js");
11
11
  const qany_js_1 = require("./qany.js");
12
12
  const aibotk_js_1 = require("../aibotk.js");
13
13
  const global_js_1 = __importDefault(require("../../db/global.js"));
14
+ const userDb_js_1 = require("../../db/userDb.js");
14
15
  /**
15
16
  * 消息转发
16
17
  * @param {botType: 机器人类别, content: 消息内容, uid: 说话的用户id, updateId: 更新的用户id, adminId: 对话实例id,用于分割不同配置, config: 机器人配置}
@@ -19,6 +20,7 @@ const global_js_1 = __importDefault(require("../../db/global.js"));
19
20
  async function dispatchBot({ botType, userAlias, content, id, uid, uname, roomId, roomName, adminId, config }) {
20
21
  console.log('进入定制机器人回复');
21
22
  try {
23
+ const contactSelf = await (0, userDb_js_1.getUser)();
22
24
  const gptConfig = global_js_1.default.getGptConfigById(adminId);
23
25
  let res, replys;
24
26
  switch (botType) {
@@ -30,13 +32,13 @@ async function dispatchBot({ botType, userAlias, content, id, uid, uname, roomId
30
32
  case 8:
31
33
  // dify ai
32
34
  console.log('进入Dify聊天');
33
- res = await (0, dify_js_1.getDifyAiReply)({ content, inputs: { uid, ualias: userAlias, uname, roomId, roomName } }, id, adminId, config);
35
+ res = await (0, dify_js_1.getDifyAiReply)({ content, inputs: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
34
36
  replys = res;
35
37
  break;
36
38
  case 9:
37
39
  // fastGPT api
38
40
  console.log('进入FastGPT聊天');
39
- res = await (0, chatgpt_js_1.getChatGPTReply)({ content, variables: { uid, ualias: userAlias, uname, roomId, roomName } }, id, adminId, config, true);
41
+ res = await (0, chatgpt_js_1.getChatGPTReply)({ content, variables: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config, true);
40
42
  replys = res;
41
43
  break;
42
44
  case 11:
@@ -48,7 +50,7 @@ async function dispatchBot({ botType, userAlias, content, id, uid, uname, roomId
48
50
  case 12:
49
51
  // coze v3 api
50
52
  console.log('进入Coze V3聊天');
51
- res = await (0, cozev3_js_1.getCozeV3AiReply)({ content, inputs: { uid, ualias: userAlias, uname, roomId, roomName } }, id, adminId, config);
53
+ res = await (0, cozev3_js_1.getCozeV3AiReply)({ content, inputs: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
52
54
  replys = res;
53
55
  break;
54
56
  case 13:
@@ -14,6 +14,7 @@ const cozeV3Ai_js_1 = require("../proxy/cozeV3Ai.js");
14
14
  const cozeAi_js_1 = require("../proxy/cozeAi.js");
15
15
  const qAnyAi_js_1 = require("../proxy/qAnyAi.js");
16
16
  const outapi_js_1 = require("../proxy/outapi.js");
17
+ const userDb_js_1 = require("../db/userDb.js");
17
18
  /**
18
19
  * 根据事件名称分配不同的api处理,并获取返回内容
19
20
  * @param {string} eName 事件名称
@@ -152,6 +153,7 @@ exports.dispatchEventContent = dispatchEventContent;
152
153
  async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias, roomName }) {
153
154
  try {
154
155
  let res, replys;
156
+ const contactSelf = await (0, userDb_js_1.getUser)();
155
157
  switch (bot) {
156
158
  case 0:
157
159
  // 天行机器人
@@ -170,12 +172,12 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
170
172
  break;
171
173
  case 8:
172
174
  // dify ai
173
- res = await (0, difyAi_js_1.getDifyReply)({ content: msg, id, inputs: { uid, ualias: userAlias, uname, roomId, roomName } });
175
+ res = await (0, difyAi_js_1.getDifyReply)({ content: msg, id, inputs: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
174
176
  replys = res;
175
177
  break;
176
178
  case 9:
177
179
  // fast gpt
178
- res = await (0, openAi_js_1.getGptOfficialReply)(msg, id, true, { uid, uname, ualias: userAlias, roomId, roomName });
180
+ res = await (0, openAi_js_1.getGptOfficialReply)(msg, id, true, { uid, uname, ualias: userAlias, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name });
179
181
  replys = res;
180
182
  break;
181
183
  case 11:
@@ -185,7 +187,7 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
185
187
  break;
186
188
  case 12:
187
189
  // coze v3
188
- res = await (0, cozeV3Ai_js_1.getCozeV3Reply)({ content: msg, id, inputs: { uid, ualias: userAlias, uname, roomId, roomName } });
190
+ res = await (0, cozeV3Ai_js_1.getCozeV3Reply)({ content: msg, id, inputs: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
189
191
  replys = res;
190
192
  break;
191
193
  case 13:
@@ -208,6 +210,7 @@ exports.dispatchAiBot = dispatchAiBot;
208
210
  async function dispatchSummerBot({ content, id, uid, uname, roomId, roomName, userAlias, config }) {
209
211
  try {
210
212
  let res, replys;
213
+ const contactSelf = await (0, userDb_js_1.getUser)();
211
214
  switch (config.botType) {
212
215
  case 6:
213
216
  // ChatGPT-api
@@ -216,12 +219,12 @@ async function dispatchSummerBot({ content, id, uid, uname, roomId, roomName, us
216
219
  break;
217
220
  case 8:
218
221
  // dify ai
219
- res = await (0, difyAi_js_1.getDifySimpleReply)({ content, id, inputs: { uid, uname, ualias: userAlias, roomId, roomName }, config });
222
+ res = await (0, difyAi_js_1.getDifySimpleReply)({ content, id, inputs: { uid, uname, ualias: userAlias, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name }, config });
220
223
  replys = res;
221
224
  break;
222
225
  case 9:
223
226
  // fast gpt
224
- res = await (0, openAi_js_1.getSimpleGptReply)({ content, uid: id, config, isFastGPT: true, variables: { uid, ualias: userAlias, uname, roomId, roomName } });
227
+ res = await (0, openAi_js_1.getSimpleGptReply)({ content, uid: id, config, isFastGPT: true, variables: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
225
228
  replys = res;
226
229
  break;
227
230
  case 11:
@@ -231,7 +234,7 @@ async function dispatchSummerBot({ content, id, uid, uname, roomId, roomName, us
231
234
  break;
232
235
  case 12:
233
236
  // coze v3
234
- res = await (0, cozeV3Ai_js_1.getCozeV3SimpleReply)({ content, id, inputs: { uid, uname, ualias: userAlias, roomId, roomName }, config });
237
+ res = await (0, cozeV3Ai_js_1.getCozeV3SimpleReply)({ content, id, inputs: { uid, uname, ualias: userAlias, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name }, config });
235
238
  replys = res;
236
239
  break;
237
240
  default:
@@ -52,7 +52,7 @@ async function filterFriendMsg(that, contact, msg) {
52
52
  { bool: config.preventLength && msg.length > config.preventLength, method: 'maxLengthMsg' },
53
53
  { bool: msg.includes(NEWADDFRIEND), method: 'newFriendMsg' },
54
54
  { bool: config.roomJoinKeywords && config.roomJoinKeywords.length > 0, method: 'roomInviteMsg' },
55
- { bool: msg.startsWith(REMINDKEY), method: 'scheduleJobMsg' },
55
+ { bool: msg.startsWith(REMINDKEY) && !config.no_remind, method: 'scheduleJobMsg' },
56
56
  { bool: config.forwards && config.forwards.length > 0, method: 'keywordForward' },
57
57
  { bool: config.callBackEvents && config.callBackEvents.length > 0, method: 'callbackEvent' },
58
58
  { bool: config.preventWords, method: 'preventWordCheck' },
@@ -445,6 +445,7 @@ async function customBot({ that, msg, name, userAlias, id, config, room, isMenti
445
445
  const topic = room ? await room.topic() : '';
446
446
  const data = {
447
447
  robotId: contactSelf.robotId,
448
+ robotName: contactSelf.name,
448
449
  uid: id,
449
450
  uname: name,
450
451
  ualias: userAlias,
@@ -455,7 +456,7 @@ async function customBot({ that, msg, name, userAlias, id, config, room, isMenti
455
456
  item.moreData &&
456
457
  item.moreData.length &&
457
458
  item.moreData.forEach((mItem) => {
458
- if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'ualias' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName' && mItem.key !== 'robotId') {
459
+ if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'ualias' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName' && mItem.key !== 'robotId' && mItem.key !== 'robotName') {
459
460
  data[mItem.key] = mItem.value;
460
461
  }
461
462
  });
@@ -8,6 +8,7 @@ import { allConfig } from '../db/configDb.js';
8
8
  import { getPuppetEol, isWindowsPlatform } from "../const/puppet-type.js";
9
9
  import dayjs from "dayjs";
10
10
  import { addHistory } from "../db/chatHistory.js";
11
+ import { getPuppetInfo } from "../db/puppetDb.js";
11
12
  async function formatContent(text) {
12
13
  text = text.replaceAll('\\n', '\n');
13
14
  const isWin = await isWindowsPlatform();
@@ -286,9 +287,17 @@ async function roomSay(room, contact, msg) {
286
287
  else if (msg.type === 8 && msg.url && msg.voiceLength) {
287
288
  const fileBox = FileBox.fromUrl(msg.url);
288
289
  fileBox.mimeType = "audio/silk";
289
- fileBox.metadata = {
290
- voiceLength: msg.voiceLength,
291
- };
290
+ const puppetInfo = await getPuppetInfo();
291
+ if (puppetInfo.puppetType === 'PuppetService') {
292
+ fileBox.metadata = {
293
+ duration: msg.voiceLength / 1000,
294
+ };
295
+ }
296
+ else {
297
+ fileBox.metadata = {
298
+ voiceLength: msg.voiceLength,
299
+ };
300
+ }
292
301
  await room.say(fileBox);
293
302
  }
294
303
  }
@@ -362,9 +371,17 @@ async function contactSay(contact, msg, isRoom = false) {
362
371
  else if (msg.type === 8 && msg.url && msg.voiceLength) {
363
372
  const fileBox = FileBox.fromUrl(msg.url);
364
373
  fileBox.mimeType = "audio/silk";
365
- fileBox.metadata = {
366
- voiceLength: msg.voiceLength,
367
- };
374
+ const puppetInfo = await getPuppetInfo();
375
+ if (puppetInfo.puppetType === 'PuppetService') {
376
+ fileBox.metadata = {
377
+ duration: msg.voiceLength / 1000,
378
+ };
379
+ }
380
+ else {
381
+ fileBox.metadata = {
382
+ voiceLength: msg.voiceLength,
383
+ };
384
+ }
368
385
  await contact.say(fileBox);
369
386
  }
370
387
  }
@@ -23,6 +23,7 @@ export namespace PUPPET_MAP {
23
23
  const PuppetOICQ: string;
24
24
  const PuppetLark: string;
25
25
  const PuppetService: string;
26
+ const PuppetMatrix: string;
26
27
  }
27
28
  export const WRAP_REPLACE_PUPPET: string[];
28
29
  export const SEND_APP_MSG_PUPPET: string[];
@@ -25,6 +25,7 @@ export const PUPPET_MAP = {
25
25
  // https://github.com/wechaty/puppet-lark
26
26
  'PuppetLark': '飞书协议',
27
27
  'PuppetService': '企微协议',
28
+ 'PuppetMatrix': 'ipad协议',
28
29
  };
29
30
  // 需要处理换行的puppet 主要是 windows 平台下需要把\n 换成\r\n
30
31
  export const WRAP_REPLACE_PUPPET = [
@@ -41,6 +41,7 @@ function checkIgnore(msg, list) {
41
41
  async function dispatchFriendFilterByMsgType(that, msg) {
42
42
  try {
43
43
  const eol = await getPuppetEol();
44
+ const puppetInfo = await getPuppetInfo();
44
45
  const aibotConfig = await getAibotConfig();
45
46
  const config = await allConfig();
46
47
  const type = msg.type();
@@ -55,6 +56,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
55
56
  return;
56
57
  }
57
58
  switch (type) {
59
+ case that.Message.Type.System:
58
60
  case that.Message.Type.Text:
59
61
  case that.Message.Type.Url:
60
62
  if (type === that.Message.Type.Url) {
@@ -67,6 +69,15 @@ async function dispatchFriendFilterByMsgType(that, msg) {
67
69
  console.log('urlLink', urlLink);
68
70
  content = `[链接]:${urlLink.url()}`;
69
71
  }
72
+ else if (type === that.Message.Type.System) {
73
+ const stext = msg.text();
74
+ if ((stext.includes('你已添加') || stext.includes('You have added')) && puppetInfo.puppetType === 'PuppetMatrix') {
75
+ content = msg.text();
76
+ }
77
+ else {
78
+ return;
79
+ }
80
+ }
70
81
  else {
71
82
  content = msg.text();
72
83
  }
@@ -104,7 +115,6 @@ async function dispatchFriendFilterByMsgType(that, msg) {
104
115
  }
105
116
  break;
106
117
  case that.Message.Type.Audio:
107
- const puppetInfo = await getPuppetInfo();
108
118
  let finalConfig = await getCustomConfig({ name, id: contact.id, roomName: '', roomId: '', room: false, type: 'openWhisper' });
109
119
  if (!finalConfig && config?.customBot?.openWhisper) {
110
120
  finalConfig = {
@@ -46,6 +46,7 @@ export namespace packageJson {
46
46
  "eslint-plugin-prettier": string;
47
47
  "npm-run-all": string;
48
48
  prettier: string;
49
+ "wechaty-puppet-matrix": string;
49
50
  "wechaty-puppet-wechat4u": string;
50
51
  };
51
52
  const readme: string;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const packageJson = {
5
5
  "name": "wechaty-web-panel",
6
- "version": "1.6.65",
6
+ "version": "1.6.67",
7
7
  "description": "智能微秘书插件",
8
8
  "exports": {
9
9
  ".": {
@@ -64,6 +64,7 @@ export const packageJson = {
64
64
  "eslint-plugin-prettier": "^3.1.4",
65
65
  "npm-run-all": "^4.1.5",
66
66
  "prettier": "^2.0.5",
67
+ "wechaty-puppet-matrix": "^0.0.8",
67
68
  "wechaty-puppet-wechat4u": "^1.14.12"
68
69
  },
69
70
  "readme": "README.md",
@@ -202,6 +202,7 @@ async function getConfig() {
202
202
  }
203
203
  let cres = await updateConfig({
204
204
  puppetType: 'wechaty-puppet-wechat',
205
+ no_remind: false,
205
206
  botScope: 'all',
206
207
  parseMini: false,
207
208
  openaiSystemMessage: '',
@@ -5,6 +5,7 @@ import { getCozeV3AiReply } from './cozev3.js';
5
5
  import { getQAnyReply } from './qany.js';
6
6
  import { updateChatRecord } from "../aibotk.js";
7
7
  import globalConfig from '../../db/global.js';
8
+ import { getUser } from "../../db/userDb.js";
8
9
  /**
9
10
  * 消息转发
10
11
  * @param {botType: 机器人类别, content: 消息内容, uid: 说话的用户id, updateId: 更新的用户id, adminId: 对话实例id,用于分割不同配置, config: 机器人配置}
@@ -13,6 +14,7 @@ import globalConfig from '../../db/global.js';
13
14
  export async function dispatchBot({ botType, userAlias, content, id, uid, uname, roomId, roomName, adminId, config }) {
14
15
  console.log('进入定制机器人回复');
15
16
  try {
17
+ const contactSelf = await getUser();
16
18
  const gptConfig = globalConfig.getGptConfigById(adminId);
17
19
  let res, replys;
18
20
  switch (botType) {
@@ -24,13 +26,13 @@ export async function dispatchBot({ botType, userAlias, content, id, uid, uname,
24
26
  case 8:
25
27
  // dify ai
26
28
  console.log('进入Dify聊天');
27
- res = await getDifyAiReply({ content, inputs: { uid, ualias: userAlias, uname, roomId, roomName } }, id, adminId, config);
29
+ res = await getDifyAiReply({ content, inputs: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
28
30
  replys = res;
29
31
  break;
30
32
  case 9:
31
33
  // fastGPT api
32
34
  console.log('进入FastGPT聊天');
33
- res = await getChatGPTReply({ content, variables: { uid, ualias: userAlias, uname, roomId, roomName } }, id, adminId, config, true);
35
+ res = await getChatGPTReply({ content, variables: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config, true);
34
36
  replys = res;
35
37
  break;
36
38
  case 11:
@@ -42,7 +44,7 @@ export async function dispatchBot({ botType, userAlias, content, id, uid, uname,
42
44
  case 12:
43
45
  // coze v3 api
44
46
  console.log('进入Coze V3聊天');
45
- res = await getCozeV3AiReply({ content, inputs: { uid, ualias: userAlias, uname, roomId, roomName } }, id, adminId, config);
47
+ res = await getCozeV3AiReply({ content, inputs: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } }, id, adminId, config);
46
48
  replys = res;
47
49
  break;
48
50
  case 13:
@@ -11,6 +11,7 @@ import { getCozeV3Reply, reset as cozeV3Reset, getCozeV3SimpleReply } from "../p
11
11
  import { getCozeReply, reset as cozeReset, getCozeSimpleReply } from '../proxy/cozeAi.js';
12
12
  import { getQAnyReply, reset as qanyReset, getQAnySimpleReply } from '../proxy/qAnyAi.js';
13
13
  import { outApi } from '../proxy/outapi.js';
14
+ import { getUser } from "../db/userDb.js";
14
15
  /**
15
16
  * 根据事件名称分配不同的api处理,并获取返回内容
16
17
  * @param {string} eName 事件名称
@@ -148,6 +149,7 @@ async function dispatchEventContent(that, eName, msg, name, id, avatar, room, ro
148
149
  async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias, roomName }) {
149
150
  try {
150
151
  let res, replys;
152
+ const contactSelf = await getUser();
151
153
  switch (bot) {
152
154
  case 0:
153
155
  // 天行机器人
@@ -166,12 +168,12 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
166
168
  break;
167
169
  case 8:
168
170
  // dify ai
169
- res = await getDifyReply({ content: msg, id, inputs: { uid, ualias: userAlias, uname, roomId, roomName } });
171
+ res = await getDifyReply({ content: msg, id, inputs: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
170
172
  replys = res;
171
173
  break;
172
174
  case 9:
173
175
  // fast gpt
174
- res = await getGptOfficialReply(msg, id, true, { uid, uname, ualias: userAlias, roomId, roomName });
176
+ res = await getGptOfficialReply(msg, id, true, { uid, uname, ualias: userAlias, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name });
175
177
  replys = res;
176
178
  break;
177
179
  case 11:
@@ -181,7 +183,7 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
181
183
  break;
182
184
  case 12:
183
185
  // coze v3
184
- res = await getCozeV3Reply({ content: msg, id, inputs: { uid, ualias: userAlias, uname, roomId, roomName } });
186
+ res = await getCozeV3Reply({ content: msg, id, inputs: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
185
187
  replys = res;
186
188
  break;
187
189
  case 13:
@@ -203,6 +205,7 @@ async function dispatchAiBot({ bot, msg, name, id, uid, uname, roomId, userAlias
203
205
  async function dispatchSummerBot({ content, id, uid, uname, roomId, roomName, userAlias, config }) {
204
206
  try {
205
207
  let res, replys;
208
+ const contactSelf = await getUser();
206
209
  switch (config.botType) {
207
210
  case 6:
208
211
  // ChatGPT-api
@@ -211,12 +214,12 @@ async function dispatchSummerBot({ content, id, uid, uname, roomId, roomName, us
211
214
  break;
212
215
  case 8:
213
216
  // dify ai
214
- res = await getDifySimpleReply({ content, id, inputs: { uid, uname, ualias: userAlias, roomId, roomName }, config });
217
+ res = await getDifySimpleReply({ content, id, inputs: { uid, uname, ualias: userAlias, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name }, config });
215
218
  replys = res;
216
219
  break;
217
220
  case 9:
218
221
  // fast gpt
219
- res = await getSimpleGptReply({ content, uid: id, config, isFastGPT: true, variables: { uid, ualias: userAlias, uname, roomId, roomName } });
222
+ res = await getSimpleGptReply({ content, uid: id, config, isFastGPT: true, variables: { uid, ualias: userAlias, uname, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name } });
220
223
  replys = res;
221
224
  break;
222
225
  case 11:
@@ -226,7 +229,7 @@ async function dispatchSummerBot({ content, id, uid, uname, roomId, roomName, us
226
229
  break;
227
230
  case 12:
228
231
  // coze v3
229
- res = await getCozeV3SimpleReply({ content, id, inputs: { uid, uname, ualias: userAlias, roomId, roomName }, config });
232
+ res = await getCozeV3SimpleReply({ content, id, inputs: { uid, uname, ualias: userAlias, roomId, roomName, robotId: contactSelf.robotId, robotName: contactSelf.name }, config });
230
233
  replys = res;
231
234
  break;
232
235
  default:
@@ -46,7 +46,7 @@ async function filterFriendMsg(that, contact, msg) {
46
46
  { bool: config.preventLength && msg.length > config.preventLength, method: 'maxLengthMsg' },
47
47
  { bool: msg.includes(NEWADDFRIEND), method: 'newFriendMsg' },
48
48
  { bool: config.roomJoinKeywords && config.roomJoinKeywords.length > 0, method: 'roomInviteMsg' },
49
- { bool: msg.startsWith(REMINDKEY), method: 'scheduleJobMsg' },
49
+ { bool: msg.startsWith(REMINDKEY) && !config.no_remind, method: 'scheduleJobMsg' },
50
50
  { bool: config.forwards && config.forwards.length > 0, method: 'keywordForward' },
51
51
  { bool: config.callBackEvents && config.callBackEvents.length > 0, method: 'callbackEvent' },
52
52
  { bool: config.preventWords, method: 'preventWordCheck' },
@@ -426,6 +426,7 @@ async function customBot({ that, msg, name, userAlias, id, config, room, isMenti
426
426
  const topic = room ? await room.topic() : '';
427
427
  const data = {
428
428
  robotId: contactSelf.robotId,
429
+ robotName: contactSelf.name,
429
430
  uid: id,
430
431
  uname: name,
431
432
  ualias: userAlias,
@@ -436,7 +437,7 @@ async function customBot({ that, msg, name, userAlias, id, config, room, isMenti
436
437
  item.moreData &&
437
438
  item.moreData.length &&
438
439
  item.moreData.forEach((mItem) => {
439
- if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'ualias' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName' && mItem.key !== 'robotId') {
440
+ if (mItem.key !== 'uid' && mItem.key !== 'uname' && mItem.key !== 'ualias' && mItem.key !== 'word' && mItem.key !== 'roomId' && mItem.key !== 'roomName' && mItem.key !== 'robotId' && mItem.key !== 'robotName') {
440
441
  data[mItem.key] = mItem.value;
441
442
  }
442
443
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechaty-web-panel",
3
- "version": "1.6.65",
3
+ "version": "1.6.67",
4
4
  "description": "智能微秘书插件",
5
5
  "exports": {
6
6
  ".": {
@@ -61,6 +61,7 @@
61
61
  "eslint-plugin-prettier": "^3.1.4",
62
62
  "npm-run-all": "^4.1.5",
63
63
  "prettier": "^2.0.5",
64
+ "wechaty-puppet-matrix": "^0.0.8",
64
65
  "wechaty-puppet-wechat4u": "^1.14.12"
65
66
  },
66
67
  "readme": "README.md",