wechaty-web-panel 1.6.88 → 1.6.90
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/handlers/on-callback-message.js +3 -3
- package/dist/cjs/src/handlers/on-message.js +4 -4
- package/dist/cjs/src/package-json.js +1 -1
- package/dist/esm/src/botInstance/sdk/difyClient.js +1 -0
- package/dist/esm/src/handlers/on-callback-message.js +3 -3
- package/dist/esm/src/handlers/on-message.js +4 -4
- package/dist/esm/src/package-json.js +1 -1
- package/package.json +1 -1
- package/src/botInstance/sdk/difyClient.js +2 -1
- package/src/handlers/on-callback-message.js +3 -3
- package/src/handlers/on-message.js +4 -4
- package/src/package-json.js +1 -1
|
@@ -71,7 +71,7 @@ async function onRecordMessage(msg) {
|
|
|
71
71
|
baseMsg.type = '自定义表情';
|
|
72
72
|
const emoticonFileBox = await msg.toFileBox();
|
|
73
73
|
const emoticonBuffer = await emoticonFileBox.toBuffer();
|
|
74
|
-
const emoticonUrl = await (0, oss_js_1.uploadOssFile)(`${conversationRecord?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().
|
|
74
|
+
const emoticonUrl = await (0, oss_js_1.uploadOssFile)(`${conversationRecord?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().valueOf()}_${emoticonFileBox.name}`, emoticonBuffer);
|
|
75
75
|
baseMsg.url = emoticonUrl;
|
|
76
76
|
break;
|
|
77
77
|
case this.Message.Type.Text:
|
|
@@ -110,14 +110,14 @@ async function onRecordMessage(msg) {
|
|
|
110
110
|
const isImage = fileExtname.includes('.png') || fileExtname.includes('.jpg') || fileExtname.includes('.jpeg') || fileExtname.includes('.gif');
|
|
111
111
|
baseMsg.type = isImage ? '图片' : '文件';
|
|
112
112
|
const buffer = await attachFileBox.toBuffer();
|
|
113
|
-
const url = await (0, oss_js_1.uploadOssFile)(`${conversationRecord?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().
|
|
113
|
+
const url = await (0, oss_js_1.uploadOssFile)(`${conversationRecord?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().valueOf()}_${attachFileBox.name}`, buffer);
|
|
114
114
|
baseMsg.url = url;
|
|
115
115
|
break;
|
|
116
116
|
case this.Message.Type.Audio:
|
|
117
117
|
baseMsg.type = '语音';
|
|
118
118
|
const audioFileBox = await msg.toFileBox();
|
|
119
119
|
const audioBuffer = await audioFileBox.toBuffer();
|
|
120
|
-
const audioUrl = await (0, oss_js_1.uploadOssFile)(`${conversationRecord?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().
|
|
120
|
+
const audioUrl = await (0, oss_js_1.uploadOssFile)(`${conversationRecord?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().valueOf()}_${audioFileBox.name}`, audioBuffer);
|
|
121
121
|
baseMsg.url = audioUrl;
|
|
122
122
|
break;
|
|
123
123
|
default:
|
|
@@ -178,7 +178,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
|
|
|
178
178
|
const fileExtname = path_1.default.extname(attachFileBox.name);
|
|
179
179
|
const fileType = '图片';
|
|
180
180
|
const buffer = await attachFileBox.toBuffer();
|
|
181
|
-
const url = await (0, oss_js_1.uploadGlobalOssFile)(`${uploadFileConfig?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().
|
|
181
|
+
const url = await (0, oss_js_1.uploadGlobalOssFile)(`${uploadFileConfig?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().valueOf()}_${attachFileBox.name}`, buffer);
|
|
182
182
|
const fileUrl = url;
|
|
183
183
|
const fileReplys = await (0, reply_js_1.getFileReply)({
|
|
184
184
|
that,
|
|
@@ -228,7 +228,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
|
|
|
228
228
|
const fileExtname = path_1.default.extname(attachFileBox.name);
|
|
229
229
|
const fileType = '文件';
|
|
230
230
|
const buffer = await attachFileBox.toBuffer();
|
|
231
|
-
const url = await (0, oss_js_1.uploadGlobalOssFile)(`${uploadFileConfig?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().
|
|
231
|
+
const url = await (0, oss_js_1.uploadGlobalOssFile)(`${uploadFileConfig?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().valueOf()}_${attachFileBox.name}`, buffer);
|
|
232
232
|
const fileUrl = url;
|
|
233
233
|
const fileReplys = await (0, reply_js_1.getFileReply)({
|
|
234
234
|
that,
|
|
@@ -394,7 +394,7 @@ async function dispatchRoomFilterByMsgType(that, room, msg) {
|
|
|
394
394
|
const fileExtname = path_1.default.extname(attachFileBox.name);
|
|
395
395
|
const fileType = '图片';
|
|
396
396
|
const buffer = await attachFileBox.toBuffer();
|
|
397
|
-
const url = await (0, oss_js_1.uploadGlobalOssFile)(`${uploadFileConfig?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().
|
|
397
|
+
const url = await (0, oss_js_1.uploadGlobalOssFile)(`${uploadFileConfig?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().valueOf()}_${attachFileBox.name}`, buffer);
|
|
398
398
|
const fileUrl = url;
|
|
399
399
|
const fileReplys = await (0, reply_js_1.getFileReply)({
|
|
400
400
|
that,
|
|
@@ -444,7 +444,7 @@ async function dispatchRoomFilterByMsgType(that, room, msg) {
|
|
|
444
444
|
const fileExtname = path_1.default.extname(attachFileBox.name);
|
|
445
445
|
const fileType = '文件';
|
|
446
446
|
const buffer = await attachFileBox.toBuffer();
|
|
447
|
-
const url = await (0, oss_js_1.uploadGlobalOssFile)(`${uploadFileConfig?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().
|
|
447
|
+
const url = await (0, oss_js_1.uploadGlobalOssFile)(`${uploadFileConfig?.ossConfig?.custom_path || ''}${(0, dayjs_1.default)().valueOf()}_${attachFileBox.name}`, buffer);
|
|
448
448
|
const fileUrl = url;
|
|
449
449
|
const fileReplys = await (0, reply_js_1.getFileReply)({
|
|
450
450
|
that,
|
|
@@ -66,7 +66,7 @@ async function onRecordMessage(msg) {
|
|
|
66
66
|
baseMsg.type = '自定义表情';
|
|
67
67
|
const emoticonFileBox = await msg.toFileBox();
|
|
68
68
|
const emoticonBuffer = await emoticonFileBox.toBuffer();
|
|
69
|
-
const emoticonUrl = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().
|
|
69
|
+
const emoticonUrl = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${emoticonFileBox.name}`, emoticonBuffer);
|
|
70
70
|
baseMsg.url = emoticonUrl;
|
|
71
71
|
break;
|
|
72
72
|
case this.Message.Type.Text:
|
|
@@ -105,14 +105,14 @@ async function onRecordMessage(msg) {
|
|
|
105
105
|
const isImage = fileExtname.includes('.png') || fileExtname.includes('.jpg') || fileExtname.includes('.jpeg') || fileExtname.includes('.gif');
|
|
106
106
|
baseMsg.type = isImage ? '图片' : '文件';
|
|
107
107
|
const buffer = await attachFileBox.toBuffer();
|
|
108
|
-
const url = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().
|
|
108
|
+
const url = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer);
|
|
109
109
|
baseMsg.url = url;
|
|
110
110
|
break;
|
|
111
111
|
case this.Message.Type.Audio:
|
|
112
112
|
baseMsg.type = '语音';
|
|
113
113
|
const audioFileBox = await msg.toFileBox();
|
|
114
114
|
const audioBuffer = await audioFileBox.toBuffer();
|
|
115
|
-
const audioUrl = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().
|
|
115
|
+
const audioUrl = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${audioFileBox.name}`, audioBuffer);
|
|
116
116
|
baseMsg.url = audioUrl;
|
|
117
117
|
break;
|
|
118
118
|
default:
|
|
@@ -173,7 +173,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
|
|
|
173
173
|
const fileExtname = path.extname(attachFileBox.name);
|
|
174
174
|
const fileType = '图片';
|
|
175
175
|
const buffer = await attachFileBox.toBuffer();
|
|
176
|
-
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().
|
|
176
|
+
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer);
|
|
177
177
|
const fileUrl = url;
|
|
178
178
|
const fileReplys = await getFileReply({
|
|
179
179
|
that,
|
|
@@ -223,7 +223,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
|
|
|
223
223
|
const fileExtname = path.extname(attachFileBox.name);
|
|
224
224
|
const fileType = '文件';
|
|
225
225
|
const buffer = await attachFileBox.toBuffer();
|
|
226
|
-
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().
|
|
226
|
+
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer);
|
|
227
227
|
const fileUrl = url;
|
|
228
228
|
const fileReplys = await getFileReply({
|
|
229
229
|
that,
|
|
@@ -389,7 +389,7 @@ async function dispatchRoomFilterByMsgType(that, room, msg) {
|
|
|
389
389
|
const fileExtname = path.extname(attachFileBox.name);
|
|
390
390
|
const fileType = '图片';
|
|
391
391
|
const buffer = await attachFileBox.toBuffer();
|
|
392
|
-
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().
|
|
392
|
+
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer);
|
|
393
393
|
const fileUrl = url;
|
|
394
394
|
const fileReplys = await getFileReply({
|
|
395
395
|
that,
|
|
@@ -439,7 +439,7 @@ async function dispatchRoomFilterByMsgType(that, room, msg) {
|
|
|
439
439
|
const fileExtname = path.extname(attachFileBox.name);
|
|
440
440
|
const fileType = '文件';
|
|
441
441
|
const buffer = await attachFileBox.toBuffer();
|
|
442
|
-
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().
|
|
442
|
+
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer);
|
|
443
443
|
const fileUrl = url;
|
|
444
444
|
const fileReplys = await getFileReply({
|
|
445
445
|
that,
|
package/package.json
CHANGED
|
@@ -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
|
}
|
|
@@ -66,7 +66,7 @@ async function onRecordMessage(msg) {
|
|
|
66
66
|
baseMsg.type = '自定义表情'
|
|
67
67
|
const emoticonFileBox = await msg.toFileBox();
|
|
68
68
|
const emoticonBuffer = await emoticonFileBox.toBuffer()
|
|
69
|
-
const emoticonUrl = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().
|
|
69
|
+
const emoticonUrl = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${emoticonFileBox.name}`, emoticonBuffer)
|
|
70
70
|
baseMsg.url = emoticonUrl
|
|
71
71
|
break;
|
|
72
72
|
case this.Message.Type.Text:
|
|
@@ -105,14 +105,14 @@ async function onRecordMessage(msg) {
|
|
|
105
105
|
const isImage = fileExtname.includes('.png') || fileExtname.includes('.jpg') || fileExtname.includes('.jpeg') || fileExtname.includes('.gif')
|
|
106
106
|
baseMsg.type = isImage ? '图片' : '文件'
|
|
107
107
|
const buffer = await attachFileBox.toBuffer()
|
|
108
|
-
const url = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().
|
|
108
|
+
const url = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer)
|
|
109
109
|
baseMsg.url = url
|
|
110
110
|
break
|
|
111
111
|
case this.Message.Type.Audio:
|
|
112
112
|
baseMsg.type = '语音'
|
|
113
113
|
const audioFileBox = await msg.toFileBox()
|
|
114
114
|
const audioBuffer = await audioFileBox.toBuffer()
|
|
115
|
-
const audioUrl = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().
|
|
115
|
+
const audioUrl = await uploadOssFile(`${conversationRecord?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${audioFileBox.name}`, audioBuffer)
|
|
116
116
|
baseMsg.url = audioUrl
|
|
117
117
|
break
|
|
118
118
|
default:
|
|
@@ -172,7 +172,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
|
|
|
172
172
|
const fileExtname = path.extname(attachFileBox.name)
|
|
173
173
|
const fileType = '图片'
|
|
174
174
|
const buffer = await attachFileBox.toBuffer()
|
|
175
|
-
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().
|
|
175
|
+
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer)
|
|
176
176
|
const fileUrl = url
|
|
177
177
|
const fileReplys = await getFileReply({
|
|
178
178
|
that,
|
|
@@ -224,7 +224,7 @@ async function dispatchFriendFilterByMsgType(that, msg) {
|
|
|
224
224
|
const fileExtname = path.extname(attachFileBox.name)
|
|
225
225
|
const fileType = '文件'
|
|
226
226
|
const buffer = await attachFileBox.toBuffer()
|
|
227
|
-
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().
|
|
227
|
+
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer)
|
|
228
228
|
const fileUrl = url
|
|
229
229
|
const fileReplys = await getFileReply({
|
|
230
230
|
that,
|
|
@@ -391,7 +391,7 @@ async function dispatchRoomFilterByMsgType(that, room, msg) {
|
|
|
391
391
|
const fileExtname = path.extname(attachFileBox.name)
|
|
392
392
|
const fileType = '图片'
|
|
393
393
|
const buffer = await attachFileBox.toBuffer()
|
|
394
|
-
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().
|
|
394
|
+
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer)
|
|
395
395
|
const fileUrl = url
|
|
396
396
|
const fileReplys = await getFileReply({
|
|
397
397
|
that,
|
|
@@ -444,7 +444,7 @@ async function dispatchRoomFilterByMsgType(that, room, msg) {
|
|
|
444
444
|
const fileExtname = path.extname(attachFileBox.name)
|
|
445
445
|
const fileType = '文件'
|
|
446
446
|
const buffer = await attachFileBox.toBuffer()
|
|
447
|
-
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().
|
|
447
|
+
const url = await uploadGlobalOssFile(`${uploadFileConfig?.ossConfig?.custom_path || ''}${dayjs().valueOf()}_${attachFileBox.name}`, buffer)
|
|
448
448
|
const fileUrl = url
|
|
449
449
|
const fileReplys = await getFileReply({
|
|
450
450
|
that,
|