wechaty-web-panel 1.6.125 → 1.6.127
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/bot/dify/sdk/index.js +60 -16
- package/dist/handlers/on-scan.js +7 -6
- package/dist/package-json.js +2 -2
- package/dist/proxy/aibotk.js +1 -4
- package/dist/task/customTask.js +1 -1
- package/package.json +2 -2
- package/src/bot/dify/sdk/index.js +52 -59
- package/src/handlers/on-scan.js +7 -7
- package/src/package-json.js +2 -2
- package/src/proxy/aibotk.js +2 -4
- package/src/task/customTask.js +1 -1
|
@@ -159,11 +159,20 @@ export class DifyClient {
|
|
|
159
159
|
user,
|
|
160
160
|
streaming
|
|
161
161
|
};
|
|
162
|
-
return this.sendRequest(
|
|
162
|
+
return this.sendRequest({
|
|
163
|
+
method: routes.textToAudio.method,
|
|
164
|
+
endpoint: routes.textToAudio.url(),
|
|
165
|
+
data,
|
|
166
|
+
stream: streaming
|
|
167
|
+
});
|
|
163
168
|
}
|
|
164
169
|
getMeta(user) {
|
|
165
170
|
const params = { user };
|
|
166
|
-
return this.sendRequest(
|
|
171
|
+
return this.sendRequest({
|
|
172
|
+
method: routes.getMeta.method,
|
|
173
|
+
endpoint: routes.getMeta.url(),
|
|
174
|
+
params
|
|
175
|
+
});
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
export class CompletionClient extends DifyClient {
|
|
@@ -187,7 +196,12 @@ export class CompletionClient extends DifyClient {
|
|
|
187
196
|
user,
|
|
188
197
|
response_mode: stream ? "streaming" : "blocking",
|
|
189
198
|
};
|
|
190
|
-
return this.sendRequest(
|
|
199
|
+
return this.sendRequest({
|
|
200
|
+
method: routes.runWorkflow.method,
|
|
201
|
+
endpoint: routes.runWorkflow.url(),
|
|
202
|
+
data,
|
|
203
|
+
stream
|
|
204
|
+
});
|
|
191
205
|
}
|
|
192
206
|
}
|
|
193
207
|
export class ChatClient extends DifyClient {
|
|
@@ -219,7 +233,7 @@ export class ChatClient extends DifyClient {
|
|
|
219
233
|
function unicodeToChar(text) {
|
|
220
234
|
if (!text)
|
|
221
235
|
return '';
|
|
222
|
-
return text.replace(/\\u[0-9a-f]{4}/g, (_match, p1) => {
|
|
236
|
+
return text.replace(/\\u([0-9a-f]{4})/g, (_match, p1) => {
|
|
223
237
|
return String.fromCharCode(parseInt(p1, 16));
|
|
224
238
|
});
|
|
225
239
|
}
|
|
@@ -303,7 +317,7 @@ export class ChatClient extends DifyClient {
|
|
|
303
317
|
if (this.debug) {
|
|
304
318
|
console.log('dify request error', res.data.code, res.data.message);
|
|
305
319
|
}
|
|
306
|
-
return Promise.reject(res.message);
|
|
320
|
+
return Promise.reject(res.data.message);
|
|
307
321
|
}
|
|
308
322
|
const response = res.data;
|
|
309
323
|
return {
|
|
@@ -345,15 +359,26 @@ export class ChatClient extends DifyClient {
|
|
|
345
359
|
}
|
|
346
360
|
getSuggested(message_id, user) {
|
|
347
361
|
const data = { user };
|
|
348
|
-
return this.sendRequest(
|
|
362
|
+
return this.sendRequest({
|
|
363
|
+
method: routes.getSuggested.method,
|
|
364
|
+
endpoint: routes.getSuggested.url(message_id),
|
|
365
|
+
params: data
|
|
366
|
+
});
|
|
349
367
|
}
|
|
350
368
|
stopMessage(task_id, user) {
|
|
351
369
|
const data = { user };
|
|
352
|
-
return this.sendRequest(
|
|
370
|
+
return this.sendRequest({
|
|
371
|
+
method: routes.stopChatMessage.method,
|
|
372
|
+
endpoint: routes.stopChatMessage.url(task_id),
|
|
373
|
+
data
|
|
374
|
+
});
|
|
353
375
|
}
|
|
354
376
|
audioToText(data) {
|
|
355
|
-
return this.sendRequest(
|
|
356
|
-
|
|
377
|
+
return this.sendRequest({
|
|
378
|
+
method: routes.audioToText.method,
|
|
379
|
+
endpoint: routes.audioToText.url(),
|
|
380
|
+
data,
|
|
381
|
+
headerParams: { 'Content-Type': 'multipart/form-data' }
|
|
357
382
|
});
|
|
358
383
|
}
|
|
359
384
|
}
|
|
@@ -364,25 +389,42 @@ export class WorkflowClient extends DifyClient {
|
|
|
364
389
|
response_mode: stream ? "streaming" : "blocking",
|
|
365
390
|
user
|
|
366
391
|
};
|
|
367
|
-
return this.sendRequest(
|
|
392
|
+
return this.sendRequest({
|
|
393
|
+
method: routes.runWorkflow.method,
|
|
394
|
+
endpoint: routes.runWorkflow.url(),
|
|
395
|
+
data,
|
|
396
|
+
stream
|
|
397
|
+
});
|
|
368
398
|
}
|
|
369
399
|
stop(task_id, user) {
|
|
370
400
|
const data = { user };
|
|
371
|
-
return this.sendRequest(
|
|
401
|
+
return this.sendRequest({
|
|
402
|
+
method: routes.stopWorkflow.method,
|
|
403
|
+
endpoint: routes.stopWorkflow.url(task_id),
|
|
404
|
+
data
|
|
405
|
+
});
|
|
372
406
|
}
|
|
373
407
|
info(user) {
|
|
374
408
|
const params = { user };
|
|
375
|
-
|
|
409
|
+
console.log('获取工作流信息', routes.getWorkflowInfo.method, routes.getWorkflowInfo.url());
|
|
410
|
+
return this.sendRequest({
|
|
411
|
+
method: routes.getWorkflowInfo.method,
|
|
412
|
+
endpoint: routes.getWorkflowInfo.url(),
|
|
413
|
+
params
|
|
414
|
+
});
|
|
376
415
|
}
|
|
377
416
|
result(task_id) {
|
|
378
|
-
return this.sendRequest(
|
|
417
|
+
return this.sendRequest({
|
|
418
|
+
method: routes.getWorkflowResult.method,
|
|
419
|
+
endpoint: routes.getWorkflowResult.url(task_id)
|
|
420
|
+
});
|
|
379
421
|
}
|
|
380
422
|
async getWorkflowResult(input, user, isStream) {
|
|
381
423
|
const res = await this.run(input, user, isStream);
|
|
382
424
|
function unicodeToChar(text) {
|
|
383
425
|
if (!text)
|
|
384
426
|
return '';
|
|
385
|
-
return text.replace(/\\u[0-9a-f]{4}/g, (_match, p1) => {
|
|
427
|
+
return text.replace(/\\u([0-9a-f]{4})/g, (_match, p1) => {
|
|
386
428
|
return String.fromCharCode(parseInt(p1, 16));
|
|
387
429
|
});
|
|
388
430
|
}
|
|
@@ -413,6 +455,7 @@ export class WorkflowClient extends DifyClient {
|
|
|
413
455
|
task_id = res?.workflow_run_id;
|
|
414
456
|
console.log('工作流node节点执行任务中');
|
|
415
457
|
}
|
|
458
|
+
console.log('工作流输出结果', res.event, res.data);
|
|
416
459
|
if (res.event === 'workflow_finished' || res.event === 'tts_message_end') {
|
|
417
460
|
console.log('工作流执行完毕,正在组装数据进行发送');
|
|
418
461
|
task_id = res?.workflow_run_id;
|
|
@@ -421,12 +464,13 @@ export class WorkflowClient extends DifyClient {
|
|
|
421
464
|
});
|
|
422
465
|
});
|
|
423
466
|
stream.on('end', async () => {
|
|
467
|
+
console.log('执行工作流结束');
|
|
424
468
|
const { data } = task_id ? await this.result(task_id) : { data: { outputs: '' } };
|
|
425
469
|
console.log('获取工作流执行结果', task_id, JSON.stringify(data.outputs));
|
|
426
470
|
let outputs = {};
|
|
427
471
|
if (data.outputs) {
|
|
428
472
|
try {
|
|
429
|
-
outputs = JSON.parse(data.outputs);
|
|
473
|
+
outputs = typeof data.outputs === 'object' ? data.outputs : JSON.parse(data.outputs);
|
|
430
474
|
}
|
|
431
475
|
catch (error) {
|
|
432
476
|
console.log(`获取工作流执行结果,失败:${error}`);
|
|
@@ -443,7 +487,7 @@ export class WorkflowClient extends DifyClient {
|
|
|
443
487
|
if (!isStream) {
|
|
444
488
|
if (res.data.code) {
|
|
445
489
|
console.log('Dify 工作流执行失败', res.data.code, res.data.message);
|
|
446
|
-
return Promise.reject(res.message);
|
|
490
|
+
return Promise.reject(res.data.message);
|
|
447
491
|
}
|
|
448
492
|
const response = res.data;
|
|
449
493
|
return {
|
package/dist/handlers/on-scan.js
CHANGED
|
@@ -24,11 +24,9 @@ function getQrcodeKey(qrcode) {
|
|
|
24
24
|
let url = new URL(qrcode);
|
|
25
25
|
let searchParams = new URLSearchParams(url.search.slice(1));
|
|
26
26
|
if (searchParams.get('key')) {
|
|
27
|
-
console.log('获取到二维码信息中的key');
|
|
28
27
|
globalConfig.setQrKey(searchParams.get('key'));
|
|
29
28
|
}
|
|
30
29
|
else if (extractLastPathWithCheck(qrcode)) {
|
|
31
|
-
console.log('获取到二维码信息中的key');
|
|
32
30
|
globalConfig.setQrKey(extractLastPathWithCheck(qrcode));
|
|
33
31
|
}
|
|
34
32
|
else {
|
|
@@ -44,8 +42,13 @@ async function onScan(qrcode, status) {
|
|
|
44
42
|
const aibotConfig = await getAibotConfig();
|
|
45
43
|
await getVerifyCode();
|
|
46
44
|
getQrcodeKey(qrcode);
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
if (this.puppet.constructor.name === 'PuppetMatrix') {
|
|
46
|
+
console.log('请使用快速登录器扫码登录成功后,再启动本服务,现在请关闭当前容器,快速登录器请保持2-3天再关闭,防止出现网络异常');
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
Qrterminal.generate(qrcode);
|
|
50
|
+
console.log('扫描状态', status);
|
|
51
|
+
}
|
|
49
52
|
if (scanTime >= aibotConfig.scanTimes) {
|
|
50
53
|
console.log('长时间推送登录状态,平台二维码不再更新,请重启服务,或直接在终端扫码登录');
|
|
51
54
|
}
|
|
@@ -53,8 +56,6 @@ async function onScan(qrcode, status) {
|
|
|
53
56
|
scanTime++;
|
|
54
57
|
throttle(setQrCode(qrcode, status), 15000);
|
|
55
58
|
}
|
|
56
|
-
const qrImgUrl = ['https://api.qrserver.com/v1/create-qr-code/?data=', encodeURIComponent(qrcode)].join('');
|
|
57
|
-
console.log(qrImgUrl);
|
|
58
59
|
}
|
|
59
60
|
catch (e) {
|
|
60
61
|
console.log('二维码推送报错', e);
|
package/dist/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.127",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": "./dist/index.js"
|
|
@@ -35,7 +35,7 @@ export const packageJson = {
|
|
|
35
35
|
"prettier": "^2.0.5",
|
|
36
36
|
"tsup": "^8.5.1",
|
|
37
37
|
"typescript": "^5.4",
|
|
38
|
-
"wechaty-puppet-matrix": "^0.0.
|
|
38
|
+
"wechaty-puppet-matrix": "^0.0.48"
|
|
39
39
|
},
|
|
40
40
|
"readme": "README.md",
|
|
41
41
|
"engines": {
|
package/dist/proxy/aibotk.js
CHANGED
|
@@ -500,10 +500,7 @@ async function setQrCode(url, status) {
|
|
|
500
500
|
params: { qrUrl: url, qrStatus: status },
|
|
501
501
|
};
|
|
502
502
|
let content = await aiBotReq(option);
|
|
503
|
-
if (content) {
|
|
504
|
-
console.log('推送二维码成功');
|
|
505
|
-
}
|
|
506
|
-
else {
|
|
503
|
+
if (!content) {
|
|
507
504
|
console.log('推送登录二维码失败');
|
|
508
505
|
}
|
|
509
506
|
}
|
package/dist/task/customTask.js
CHANGED
|
@@ -3,7 +3,7 @@ const getDifyWorkflowContent = async (baseurl, token, inputs) => {
|
|
|
3
3
|
try {
|
|
4
4
|
const user = 'dify-schedule';
|
|
5
5
|
console.log('getDifyWorkflowContent request info:', baseurl, token, inputs);
|
|
6
|
-
const workflow = new WorkflowClient(token, baseurl);
|
|
6
|
+
const workflow = new WorkflowClient({ apiKey: token, baseUrl: baseurl, stream: true });
|
|
7
7
|
console.log(`正在获取Dify工作流基础信息...`);
|
|
8
8
|
const info = await workflow.info(user);
|
|
9
9
|
console.log(`Dify工作流【${info.data.name}】开始执行...`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wechaty-web-panel",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.127",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./dist/index.js"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"prettier": "^2.0.5",
|
|
33
33
|
"tsup": "^8.5.1",
|
|
34
34
|
"typescript": "^5.4",
|
|
35
|
-
"wechaty-puppet-matrix": "^0.0.
|
|
35
|
+
"wechaty-puppet-matrix": "^0.0.48"
|
|
36
36
|
},
|
|
37
37
|
"readme": "README.md",
|
|
38
38
|
"engines": {
|
|
@@ -179,22 +179,20 @@ export class DifyClient {
|
|
|
179
179
|
user,
|
|
180
180
|
streaming
|
|
181
181
|
};
|
|
182
|
-
return this.sendRequest(
|
|
183
|
-
routes.textToAudio.method,
|
|
184
|
-
routes.textToAudio.url(),
|
|
182
|
+
return this.sendRequest({
|
|
183
|
+
method: routes.textToAudio.method,
|
|
184
|
+
endpoint: routes.textToAudio.url(),
|
|
185
185
|
data,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
);
|
|
186
|
+
stream: streaming
|
|
187
|
+
});
|
|
189
188
|
}
|
|
190
189
|
getMeta(user) {
|
|
191
190
|
const params = { user };
|
|
192
|
-
return this.sendRequest(
|
|
193
|
-
routes.
|
|
194
|
-
routes.
|
|
195
|
-
null,
|
|
191
|
+
return this.sendRequest({
|
|
192
|
+
method: routes.getMeta.method,
|
|
193
|
+
endpoint: routes.getMeta.url(),
|
|
196
194
|
params
|
|
197
|
-
);
|
|
195
|
+
});
|
|
198
196
|
}
|
|
199
197
|
}
|
|
200
198
|
|
|
@@ -219,13 +217,12 @@ export class CompletionClient extends DifyClient {
|
|
|
219
217
|
user,
|
|
220
218
|
response_mode: stream ? "streaming" : "blocking",
|
|
221
219
|
};
|
|
222
|
-
return this.sendRequest(
|
|
223
|
-
routes.runWorkflow.method,
|
|
224
|
-
routes.runWorkflow.url(),
|
|
220
|
+
return this.sendRequest({
|
|
221
|
+
method: routes.runWorkflow.method,
|
|
222
|
+
endpoint: routes.runWorkflow.url(),
|
|
225
223
|
data,
|
|
226
|
-
null,
|
|
227
224
|
stream
|
|
228
|
-
);
|
|
225
|
+
});
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
228
|
|
|
@@ -261,7 +258,7 @@ export class ChatClient extends DifyClient {
|
|
|
261
258
|
if (!text)
|
|
262
259
|
return ''
|
|
263
260
|
|
|
264
|
-
return text.replace(/\\u[0-9a-f]{4}/g, (_match, p1) => {
|
|
261
|
+
return text.replace(/\\u([0-9a-f]{4})/g, (_match, p1) => {
|
|
265
262
|
return String.fromCharCode(parseInt(p1, 16))
|
|
266
263
|
})
|
|
267
264
|
}
|
|
@@ -344,7 +341,7 @@ export class ChatClient extends DifyClient {
|
|
|
344
341
|
if (this.debug) {
|
|
345
342
|
console.log('dify request error', res.data.code, res.data.message)
|
|
346
343
|
}
|
|
347
|
-
return Promise.reject(res.message)
|
|
344
|
+
return Promise.reject(res.data.message)
|
|
348
345
|
}
|
|
349
346
|
|
|
350
347
|
const response = res.data
|
|
@@ -390,31 +387,27 @@ export class ChatClient extends DifyClient {
|
|
|
390
387
|
}
|
|
391
388
|
getSuggested(message_id, user) {
|
|
392
389
|
const data = { user };
|
|
393
|
-
return this.sendRequest(
|
|
394
|
-
routes.getSuggested.method,
|
|
395
|
-
routes.getSuggested.url(message_id),
|
|
396
|
-
data
|
|
397
|
-
);
|
|
390
|
+
return this.sendRequest({
|
|
391
|
+
method: routes.getSuggested.method,
|
|
392
|
+
endpoint: routes.getSuggested.url(message_id),
|
|
393
|
+
params: data
|
|
394
|
+
});
|
|
398
395
|
}
|
|
399
396
|
stopMessage(task_id, user) {
|
|
400
397
|
const data = { user };
|
|
401
|
-
return this.sendRequest(
|
|
402
|
-
routes.stopChatMessage.method,
|
|
403
|
-
routes.stopChatMessage.url(task_id),
|
|
398
|
+
return this.sendRequest({
|
|
399
|
+
method: routes.stopChatMessage.method,
|
|
400
|
+
endpoint: routes.stopChatMessage.url(task_id),
|
|
404
401
|
data
|
|
405
|
-
);
|
|
402
|
+
});
|
|
406
403
|
}
|
|
407
404
|
audioToText(data) {
|
|
408
|
-
return this.sendRequest(
|
|
409
|
-
routes.audioToText.method,
|
|
410
|
-
routes.audioToText.url(),
|
|
405
|
+
return this.sendRequest({
|
|
406
|
+
method: routes.audioToText.method,
|
|
407
|
+
endpoint: routes.audioToText.url(),
|
|
411
408
|
data,
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
{
|
|
415
|
-
"Content-Type": 'multipart/form-data'
|
|
416
|
-
}
|
|
417
|
-
);
|
|
409
|
+
headerParams: { 'Content-Type': 'multipart/form-data' }
|
|
410
|
+
});
|
|
418
411
|
}
|
|
419
412
|
}
|
|
420
413
|
|
|
@@ -427,38 +420,37 @@ export class WorkflowClient extends DifyClient {
|
|
|
427
420
|
user
|
|
428
421
|
};
|
|
429
422
|
|
|
430
|
-
return this.sendRequest(
|
|
431
|
-
routes.runWorkflow.method,
|
|
432
|
-
routes.runWorkflow.url(),
|
|
423
|
+
return this.sendRequest({
|
|
424
|
+
method: routes.runWorkflow.method,
|
|
425
|
+
endpoint: routes.runWorkflow.url(),
|
|
433
426
|
data,
|
|
434
|
-
null,
|
|
435
427
|
stream
|
|
436
|
-
);
|
|
428
|
+
});
|
|
437
429
|
}
|
|
438
430
|
|
|
439
431
|
stop(task_id, user) {
|
|
440
432
|
const data = { user };
|
|
441
|
-
return this.sendRequest(
|
|
442
|
-
routes.stopWorkflow.method,
|
|
443
|
-
routes.stopWorkflow.url(task_id),
|
|
433
|
+
return this.sendRequest({
|
|
434
|
+
method: routes.stopWorkflow.method,
|
|
435
|
+
endpoint: routes.stopWorkflow.url(task_id),
|
|
444
436
|
data
|
|
445
|
-
);
|
|
437
|
+
});
|
|
446
438
|
}
|
|
447
439
|
info(user) {
|
|
448
440
|
const params = { user };
|
|
449
|
-
|
|
450
|
-
routes.getWorkflowInfo.
|
|
451
|
-
|
|
452
|
-
|
|
441
|
+
console.log('获取工作流信息', routes.getWorkflowInfo.method,
|
|
442
|
+
routes.getWorkflowInfo.url())
|
|
443
|
+
return this.sendRequest({
|
|
444
|
+
method: routes.getWorkflowInfo.method,
|
|
445
|
+
endpoint: routes.getWorkflowInfo.url(),
|
|
453
446
|
params
|
|
454
|
-
);
|
|
447
|
+
});
|
|
455
448
|
}
|
|
456
449
|
result(task_id) {
|
|
457
|
-
return this.sendRequest(
|
|
458
|
-
routes.getWorkflowResult.method,
|
|
459
|
-
routes.getWorkflowResult.url(task_id)
|
|
460
|
-
|
|
461
|
-
);
|
|
450
|
+
return this.sendRequest({
|
|
451
|
+
method: routes.getWorkflowResult.method,
|
|
452
|
+
endpoint: routes.getWorkflowResult.url(task_id)
|
|
453
|
+
});
|
|
462
454
|
}
|
|
463
455
|
async getWorkflowResult(input, user, isStream) {
|
|
464
456
|
const res = await this.run(input, user, isStream)
|
|
@@ -466,7 +458,7 @@ export class WorkflowClient extends DifyClient {
|
|
|
466
458
|
if (!text)
|
|
467
459
|
return ''
|
|
468
460
|
|
|
469
|
-
return text.replace(/\\u[0-9a-f]{4}/g, (_match, p1) => {
|
|
461
|
+
return text.replace(/\\u([0-9a-f]{4})/g, (_match, p1) => {
|
|
470
462
|
return String.fromCharCode(parseInt(p1, 16))
|
|
471
463
|
})
|
|
472
464
|
}
|
|
@@ -497,6 +489,7 @@ export class WorkflowClient extends DifyClient {
|
|
|
497
489
|
task_id = res?.workflow_run_id
|
|
498
490
|
console.log('工作流node节点执行任务中')
|
|
499
491
|
}
|
|
492
|
+
console.log('工作流输出结果', res.event, res.data)
|
|
500
493
|
if (res.event === 'workflow_finished' || res.event === 'tts_message_end') {
|
|
501
494
|
console.log('工作流执行完毕,正在组装数据进行发送')
|
|
502
495
|
task_id = res?.workflow_run_id
|
|
@@ -505,13 +498,13 @@ export class WorkflowClient extends DifyClient {
|
|
|
505
498
|
})
|
|
506
499
|
})
|
|
507
500
|
stream.on('end', async () => {
|
|
508
|
-
|
|
501
|
+
console.log('执行工作流结束')
|
|
509
502
|
const { data } = task_id ? await this.result(task_id) : { data: { outputs: '' } }
|
|
510
503
|
console.log('获取工作流执行结果', task_id, JSON.stringify(data.outputs))
|
|
511
504
|
let outputs = {}
|
|
512
505
|
if(data.outputs) {
|
|
513
506
|
try {
|
|
514
|
-
outputs = JSON.parse(data.outputs)
|
|
507
|
+
outputs = typeof data.outputs === 'object' ? data.outputs : JSON.parse(data.outputs)
|
|
515
508
|
} catch (error) {
|
|
516
509
|
console.log(`获取工作流执行结果,失败:${error}`)
|
|
517
510
|
}
|
|
@@ -527,7 +520,7 @@ export class WorkflowClient extends DifyClient {
|
|
|
527
520
|
if (!isStream) {
|
|
528
521
|
if (res.data.code) {
|
|
529
522
|
console.log('Dify 工作流执行失败', res.data.code, res.data.message)
|
|
530
|
-
return Promise.reject(res.message)
|
|
523
|
+
return Promise.reject(res.data.message)
|
|
531
524
|
}
|
|
532
525
|
const response = res.data
|
|
533
526
|
return {
|
package/src/handlers/on-scan.js
CHANGED
|
@@ -26,10 +26,8 @@ function getQrcodeKey(qrcode) {
|
|
|
26
26
|
let url = new URL(qrcode);
|
|
27
27
|
let searchParams = new URLSearchParams(url.search.slice(1));
|
|
28
28
|
if(searchParams.get('key')) {
|
|
29
|
-
console.log('获取到二维码信息中的key')
|
|
30
29
|
globalConfig.setQrKey(searchParams.get('key'))
|
|
31
30
|
} else if(extractLastPathWithCheck(qrcode)) {
|
|
32
|
-
console.log('获取到二维码信息中的key');
|
|
33
31
|
globalConfig.setQrKey(extractLastPathWithCheck(qrcode));
|
|
34
32
|
} else {
|
|
35
33
|
globalConfig.setQrKey('')
|
|
@@ -41,20 +39,22 @@ function getQrcodeKey(qrcode) {
|
|
|
41
39
|
async function onScan(qrcode, status) {
|
|
42
40
|
try {
|
|
43
41
|
await updatePuppetConfig({ puppetType: this.puppet.constructor.name })
|
|
42
|
+
|
|
44
43
|
const aibotConfig = await getAibotConfig();
|
|
45
44
|
await getVerifyCode();
|
|
46
45
|
getQrcodeKey(qrcode)
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if (this.puppet.constructor.name === 'PuppetMatrix') {
|
|
47
|
+
console.log('请使用快速登录器扫码登录成功后,再启动本服务,现在请关闭当前容器,快速登录器请保持2-3天再关闭,防止出现网络异常')
|
|
48
|
+
} else {
|
|
49
|
+
Qrterminal.generate(qrcode)
|
|
50
|
+
console.log('扫描状态', status)
|
|
51
|
+
}
|
|
49
52
|
if(scanTime >= aibotConfig.scanTimes) {
|
|
50
53
|
console.log('长时间推送登录状态,平台二维码不再更新,请重启服务,或直接在终端扫码登录');
|
|
51
54
|
} else {
|
|
52
55
|
scanTime++
|
|
53
56
|
throttle(setQrCode(qrcode, status), 15000)
|
|
54
57
|
}
|
|
55
|
-
|
|
56
|
-
const qrImgUrl = ['https://api.qrserver.com/v1/create-qr-code/?data=', encodeURIComponent(qrcode)].join('')
|
|
57
|
-
console.log(qrImgUrl)
|
|
58
58
|
} catch (e) {
|
|
59
59
|
console.log('二维码推送报错', e)
|
|
60
60
|
}
|
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.127",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": "./dist/index.js"
|
|
@@ -35,7 +35,7 @@ export const packageJson = {
|
|
|
35
35
|
"prettier": "^2.0.5",
|
|
36
36
|
"tsup": "^8.5.1",
|
|
37
37
|
"typescript": "^5.4",
|
|
38
|
-
"wechaty-puppet-matrix": "^0.0.
|
|
38
|
+
"wechaty-puppet-matrix": "^0.0.48"
|
|
39
39
|
},
|
|
40
40
|
"readme": "README.md",
|
|
41
41
|
"engines": {
|
package/src/proxy/aibotk.js
CHANGED
|
@@ -497,10 +497,8 @@ async function setQrCode(url, status) {
|
|
|
497
497
|
params: { qrUrl: url, qrStatus: status },
|
|
498
498
|
}
|
|
499
499
|
let content = await aiBotReq(option)
|
|
500
|
-
if (content) {
|
|
501
|
-
|
|
502
|
-
} else {
|
|
503
|
-
console.log('推送登录二维码失败')
|
|
500
|
+
if (!content) {
|
|
501
|
+
console.log('推送登录二维码失败')
|
|
504
502
|
}
|
|
505
503
|
} catch (error) {
|
|
506
504
|
console.log('推送登录二维码失败', error)
|
package/src/task/customTask.js
CHANGED
|
@@ -6,7 +6,7 @@ const getDifyWorkflowContent = async (baseurl, token, inputs) => {
|
|
|
6
6
|
try {
|
|
7
7
|
const user = 'dify-schedule'
|
|
8
8
|
console.log('getDifyWorkflowContent request info:', baseurl, token, inputs)
|
|
9
|
-
const workflow = new WorkflowClient(token, baseurl);
|
|
9
|
+
const workflow = new WorkflowClient({apiKey: token, baseUrl: baseurl, stream: true});
|
|
10
10
|
console.log(`正在获取Dify工作流基础信息...`)
|
|
11
11
|
const info = await workflow.info(user);
|
|
12
12
|
console.log(`Dify工作流【${info.data.name}】开始执行...`)
|