wechaty-web-panel 1.6.9 → 1.6.11

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,11 @@
1
1
  ## 更新日志
2
2
 
3
+ ### V1.6.11(2023-06-09)
4
+ 1、修复dify角色设置bug
5
+
6
+ ### V1.6.10(2023-05-29)
7
+ 1、api添加wxid 字段
8
+
3
9
  ### V1.6.9(2023-05-24)
4
10
  1、添加dify支持
5
11
 
@@ -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",
9
+ "version": "1.6.11",
10
10
  "description": "智能微秘书插件",
11
11
  "exports": {
12
12
  ".": {
@@ -158,7 +158,9 @@ async function getConfig() {
158
158
  let content = await (0, superagent_js_1.aiBotReq)(option);
159
159
  const config = JSON.parse(content.data.config);
160
160
  const cloudRoom = await getWordCloudRoom();
161
- await getGptConfig();
161
+ if (config.role === 'vip') {
162
+ await getGptConfig();
163
+ }
162
164
  let cres = await (0, configDb_js_1.updateConfig)({
163
165
  puppetType: 'wechaty-puppet-wechat',
164
166
  botScope: 'all',
@@ -34,7 +34,7 @@ async function getChatGPTWebReply(content, uid, adminId, config = { token: "", d
34
34
  let systemMessage = '';
35
35
  if (config.keywordSystemMessages && config.keywordSystemMessages.length) {
36
36
  const finalSystemMsg = config.keywordSystemMessages.find(item => content.startsWith(item.keyword));
37
- if (finalSystemMsg) {
37
+ if (finalSystemMsg && finalSystemMsg.promotId) {
38
38
  const promotInfo = await (0, aibotk_js_1.getPromotInfo)(finalSystemMsg.promotId);
39
39
  console.log(`触发关键词角色功能,使用对应预设角色:${promotInfo.name}`);
40
40
  systemMessage = promotInfo.promot;
@@ -34,7 +34,7 @@ async function getChatGPTReply(content, uid, adminId, config = { token: "", debu
34
34
  let systemMessage = '';
35
35
  if (config.keywordSystemMessages && config.keywordSystemMessages.length) {
36
36
  const finalSystemMsg = config.keywordSystemMessages.find(item => content.startsWith(item.keyword));
37
- if (finalSystemMsg) {
37
+ if (finalSystemMsg && finalSystemMsg.promotId) {
38
38
  const promotInfo = await (0, aibotk_js_1.getPromotInfo)(finalSystemMsg.promotId);
39
39
  console.log(`触发关键词角色功能,使用对应预设角色:${promotInfo.name}`);
40
40
  systemMessage = promotInfo.promot;
@@ -34,7 +34,7 @@ async function getDifyAiReply(content, uid, adminId, config = { token: "", debug
34
34
  let systemMessage = '';
35
35
  if (config.keywordSystemMessages && config.keywordSystemMessages.length) {
36
36
  const finalSystemMsg = config.keywordSystemMessages.find(item => content.startsWith(item.keyword));
37
- if (finalSystemMsg) {
37
+ if (finalSystemMsg && finalSystemMsg.promotId) {
38
38
  const promotInfo = await (0, aibotk_js_1.getPromotInfo)(finalSystemMsg.promotId);
39
39
  console.log(`触发关键词角色功能,使用对应预设角色:${promotInfo.name}`);
40
40
  systemMessage = promotInfo.promot;
@@ -33,6 +33,7 @@ const index_js_2 = require("../task/index.js");
33
33
  const index_js_3 = require("../lib/index.js");
34
34
  const chatgpt_js_1 = require("./bot/chatgpt.js");
35
35
  const chatgpt_web_js_1 = require("./bot/chatgpt-web.js");
36
+ const dify_js_1 = require("./bot/dify.js");
36
37
  let mqttclient = null;
37
38
  async function initMqtt(that) {
38
39
  try {
@@ -74,7 +75,7 @@ async function initMqtt(that) {
74
75
  if (topic === `aibotk/${userId}/say`) {
75
76
  if (content.target === 'Room') {
76
77
  console.log(`收到群:${content.roomName}发送消息请求: ${content.message.content || content.message.url}`);
77
- const room = await that.Room.find({ topic: content.roomName });
78
+ const room = content.wxid && await that.Room.find({ id: content.wxid }) || await that.Room.find({ topic: content.roomName });
78
79
  if (!room) {
79
80
  console.log(`查找不到群:${content.roomName},请检查群名是否正确`);
80
81
  return;
@@ -85,7 +86,7 @@ async function initMqtt(that) {
85
86
  }
86
87
  else if (content.target === 'Contact') {
87
88
  console.log(`收到联系人:${content.alias || content.name}发送消息请求: ${content.message.content || content.message.url}`);
88
- let contact = (await that.Contact.find({ name: content.name })) || (await that.Contact.find({ alias: content.alias })) || (await that.Contact.find({ weixin: content.weixin })); // 获取你要发送的联系人
89
+ let contact = (content.wxid && await that.Contact.load(content.wxid)) || (await that.Contact.find({ name: content.name })) || (await that.Contact.find({ alias: content.alias })) || (await that.Contact.find({ weixin: content.weixin })); // 获取你要发送的联系人
89
90
  if (!contact) {
90
91
  console.log(`查找不到联系人:${content.name || content.alias},请检查联系人名称是否正确`);
91
92
  return;
@@ -117,6 +118,7 @@ async function initMqtt(that) {
117
118
  console.log('更新gpt配置');
118
119
  (0, chatgpt_js_1.reset)(content.updateId);
119
120
  (0, chatgpt_web_js_1.reset)(content.updateId);
121
+ (0, dify_js_1.reset)(content.updateId);
120
122
  }
121
123
  }
122
124
  });
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const packageJson = {
5
5
  "name": "wechaty-web-panel",
6
- "version": "1.6.9",
6
+ "version": "1.6.11",
7
7
  "description": "智能微秘书插件",
8
8
  "exports": {
9
9
  ".": {
@@ -149,7 +149,9 @@ async function getConfig() {
149
149
  let content = await aiBotReq(option);
150
150
  const config = JSON.parse(content.data.config);
151
151
  const cloudRoom = await getWordCloudRoom();
152
- await getGptConfig();
152
+ if (config.role === 'vip') {
153
+ await getGptConfig();
154
+ }
153
155
  let cres = await updateConfig({
154
156
  puppetType: 'wechaty-puppet-wechat',
155
157
  botScope: 'all',
@@ -26,7 +26,7 @@ export async function getChatGPTWebReply(content, uid, adminId, config = { token
26
26
  let systemMessage = '';
27
27
  if (config.keywordSystemMessages && config.keywordSystemMessages.length) {
28
28
  const finalSystemMsg = config.keywordSystemMessages.find(item => content.startsWith(item.keyword));
29
- if (finalSystemMsg) {
29
+ if (finalSystemMsg && finalSystemMsg.promotId) {
30
30
  const promotInfo = await getPromotInfo(finalSystemMsg.promotId);
31
31
  console.log(`触发关键词角色功能,使用对应预设角色:${promotInfo.name}`);
32
32
  systemMessage = promotInfo.promot;
@@ -26,7 +26,7 @@ export async function getChatGPTReply(content, uid, adminId, config = { token: "
26
26
  let systemMessage = '';
27
27
  if (config.keywordSystemMessages && config.keywordSystemMessages.length) {
28
28
  const finalSystemMsg = config.keywordSystemMessages.find(item => content.startsWith(item.keyword));
29
- if (finalSystemMsg) {
29
+ if (finalSystemMsg && finalSystemMsg.promotId) {
30
30
  const promotInfo = await getPromotInfo(finalSystemMsg.promotId);
31
31
  console.log(`触发关键词角色功能,使用对应预设角色:${promotInfo.name}`);
32
32
  systemMessage = promotInfo.promot;
@@ -26,7 +26,7 @@ export async function getDifyAiReply(content, uid, adminId, config = { token: ""
26
26
  let systemMessage = '';
27
27
  if (config.keywordSystemMessages && config.keywordSystemMessages.length) {
28
28
  const finalSystemMsg = config.keywordSystemMessages.find(item => content.startsWith(item.keyword));
29
- if (finalSystemMsg) {
29
+ if (finalSystemMsg && finalSystemMsg.promotId) {
30
30
  const promotInfo = await getPromotInfo(finalSystemMsg.promotId);
31
31
  console.log(`触发关键词角色功能,使用对应预设角色:${promotInfo.name}`);
32
32
  systemMessage = promotInfo.promot;
@@ -7,6 +7,7 @@ import { sendTaskMessage } from "../task/index.js";
7
7
  import { randomRange } from '../lib/index.js';
8
8
  import { reset } from './bot/chatgpt.js';
9
9
  import { reset as webReset } from './bot/chatgpt-web.js';
10
+ import { reset as difyReset } from './bot/dify.js';
10
11
  let mqttclient = null;
11
12
  async function initMqtt(that) {
12
13
  try {
@@ -48,7 +49,7 @@ async function initMqtt(that) {
48
49
  if (topic === `aibotk/${userId}/say`) {
49
50
  if (content.target === 'Room') {
50
51
  console.log(`收到群:${content.roomName}发送消息请求: ${content.message.content || content.message.url}`);
51
- const room = await that.Room.find({ topic: content.roomName });
52
+ const room = content.wxid && await that.Room.find({ id: content.wxid }) || await that.Room.find({ topic: content.roomName });
52
53
  if (!room) {
53
54
  console.log(`查找不到群:${content.roomName},请检查群名是否正确`);
54
55
  return;
@@ -59,7 +60,7 @@ async function initMqtt(that) {
59
60
  }
60
61
  else if (content.target === 'Contact') {
61
62
  console.log(`收到联系人:${content.alias || content.name}发送消息请求: ${content.message.content || content.message.url}`);
62
- let contact = (await that.Contact.find({ name: content.name })) || (await that.Contact.find({ alias: content.alias })) || (await that.Contact.find({ weixin: content.weixin })); // 获取你要发送的联系人
63
+ let contact = (content.wxid && await that.Contact.load(content.wxid)) || (await that.Contact.find({ name: content.name })) || (await that.Contact.find({ alias: content.alias })) || (await that.Contact.find({ weixin: content.weixin })); // 获取你要发送的联系人
63
64
  if (!contact) {
64
65
  console.log(`查找不到联系人:${content.name || content.alias},请检查联系人名称是否正确`);
65
66
  return;
@@ -91,6 +92,7 @@ async function initMqtt(that) {
91
92
  console.log('更新gpt配置');
92
93
  reset(content.updateId);
93
94
  webReset(content.updateId);
95
+ difyReset(content.updateId);
94
96
  }
95
97
  }
96
98
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechaty-web-panel",
3
- "version": "1.6.9",
3
+ "version": "1.6.11",
4
4
  "description": "智能微秘书插件",
5
5
  "exports": {
6
6
  ".": {